Get frame source with jQuery (after the source has changed)

ryonlife picture ryonlife · Feb 14, 2009 · Viewed 19.7k times · Source

This jQuery will return the source URL of a frame:

$('#frame-name').attr('src')

But if a link inside the frame is clicked, the original source is still returned.

Is it possible to detect the new source URL? Or get the source of the new document loaded in the frame? If either of those is a yes, are there security constraints if the source frame contains an URL from a different domain?

Answer

ryonlife picture ryonlife · Feb 15, 2009
parent.frames[1].location.href;

Not jQuery, but what I was looking for. However, kicks a security error if the source is on a different domain.