iframe 内容更改事件? [英] iframe contents change event?
本文介绍了iframe 内容更改事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何检测 iframe 内容何时发生更改并根据下面的更改伪代码执行某些操作
How can I detect when the iframe content has changed and do something upon that change pseudo code below
$('#waframe').contents().change(function(){
//do stuff
});
推荐答案
好吧,浏览器似乎在包含页面上下文中的 元素上生成加载"事件.当src"改变时load"触发;不确定它是否会在 iframe 自身更改时触发.
Well, the browser seems to generate a "load" event on an <iframe>
element in the context of the containing page. The "load" fires when the "src" is changed; not sure whether it fires when the iframe changes itself.
是的,当页面内部"重新加载时,它似乎会触发
edit: yes it does seem to fire when the page reloads "internally"
因此您可以尝试:
$('iframe#yourId').load(function() {
alert("the iframe has been loaded");
});
这篇关于iframe 内容更改事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文