简体   繁体   English

当iFrame更改页面时

[英]When iFrame changes page

Is there any way you can fire a function when a iframe has changed its page (load function), without having to add anything to the iframe content? iframe更改了页面(加载功能)时,是否有任何方法可以触发功能而无需向iframe内容添加任何内容?

Thank you in advance. 先感谢您。

I'm assuming the iframe contents are from another origin, in which case the answer is no. 我假设iframe的内容来自其他来源,在这种情况下,答案是否定的。 Browsers won't tell you the current URL of a child iframe unless its same-origin, so I don't think they'll fire an event when it changes. 除非其来源相同,否则浏览器不会告诉您子iframe的当前URL,因此我认为它们不会在事件发生变化时触发。

Here's a demo which recognises when the first load event takes place, but doesn't log any subsequent page changes: http://jsfiddle.net/GPh6H/ 这是一个演示,该演示可识别何时发生第一个加载事件,但不记录任何后续页面更改: http : //jsfiddle.net/GPh6H/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM