admin管理员组文章数量:1392047
i have iframe with src like /
, and when ever the src is get changed i need to trigger a function like iframeSrcChanged()
<iframe id="iframe" src="/" frameborder="0" width="100%" height="100%" ></iframe>
and when user click about-us inside iframe, the iframe src get changed into
<iframe id="iframe" src=".html" frameborder="0" width="100%" height="100%" ></iframe>
so this time i need to trigger iframeSrcChanged()
function.
Please help me to trigger out this issue.
i have iframe with src like http://remote-domain./
, and when ever the src is get changed i need to trigger a function like iframeSrcChanged()
<iframe id="iframe" src="http://remote-domain./" frameborder="0" width="100%" height="100%" ></iframe>
and when user click about-us inside iframe, the iframe src get changed into
<iframe id="iframe" src="http://remote-domain./about-us.html" frameborder="0" width="100%" height="100%" ></iframe>
so this time i need to trigger iframeSrcChanged()
function.
Please help me to trigger out this issue.
Share Improve this question asked Oct 21, 2013 at 15:33 rkaartikeyanrkaartikeyan 2,0079 gold badges30 silver badges57 bronze badges 1- Please see stackoverflow./questions/2429045/… – Tsanyo Tsanev Commented Oct 21, 2013 at 15:41
1 Answer
Reset to default 2var iframe = document.getElementById("iframe");
iframe.addEventListener("DOMAttrModified", function(event) {
if (event.attrName == "src") {
// The "src" attribute changed
}
});
However this will work only in modern browsers
本文标签: javascriptHow to trigger a function when iframe src changeStack Overflow
版权声明:本文标题:javascript - How to trigger a function when iframe src change? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744773424a2624480.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论