开发者

How to get notified about IFRAME appended dynamically and loaded?

I need to add an ability to a Firefox extension to handle cases when IFRAME elements are being added dynamically. Is there a way to get notified when IFRAME document is loaded in such a case?

For example:

<html> 
<head> 

<title>iframe test</title> 

<script type="text/javascript">
  function addIFrame() {
    var ifrm = document.createElement("iframe");
    ifrm.setAttribute("src", " http://www.google.com/");
    document.body.appendChild(ifrm);
  }
  setTimeout('addIFrame()', 3000);
</script> 
</head> 

<body>
<p>A new &lt;i开发者_运维问答frame&gt; will be added in 3 seconds:</p>
</body>

</html>


You can set a capturing load listener on the tabbrowser and then check that the event's target is an <html:iframe>.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜