Is there a way for me to find out if the URL in my iframe has been changed, ie, the user has navigated somewhere? Thanks.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
A similar question over here has some answers that should help you out. If you keep track of where the iframe starts, you can then use the methods in that link to see if it has changed.
回答2:
yourIframeName.onbeforeunload = function () {
//do something
}
This will trigger your function just before navigating to another page on iframe.
This behaves weird on somebrowsers though.