Detect If The Url In An Iframe Has Changed
Is there anyway to detect if a user clicks a link inside of an iframe if the iframe is not on the same domain as the parent page? EDIT: I don't have access to the iframed page. I o
Solution 1:
No. Due to the javascript same-origin policy, you cannot access any members of the iframe's DOM if the iframe did not serve from the same domain as the page on which your javascript is running.
Solution 2:
if (window.domain !== top.domain) {
// they are not the same
}
Solution 3:
Try this.
var isInSameDomain = (window.location.host == window.parent.location.host);
Post a Comment for "Detect If The Url In An Iframe Has Changed"