I am working with an iframe object that is currently set to a specific page's URL. Here is an example:
<iframe src="http://en.wikipedia.org/wiki/Special:Random"></iframe>
My goal is to display an alert whenever the location of the iframe changes as a result of the user clicking on a link within it.
Trying
onLoad="alert(this.ContentWindow.location.href);"
does not produce the desired outcome.
Similarly, using onLoad="alert(this.src);"
only displays the initial source (../wiki/Special:Random) regardless of the user's actions.
It is important to note that the user will remain within the same domain, so the Same Origin policy is not being breached.