How to properly receive the DOMContentLoaded event from an XUL iframe?

后端 未结 2 1794
无人共我
无人共我 2021-01-13 17:58

I\'m working on a minimal Firefox extension that loads a web page into an XUL iframe. (I also tried the html:iframe, but met identical results.) The page may

2条回答
  •  囚心锁ツ
    2021-01-13 18:32

    According to the Gecko documentation, DOMFrameContentLoaded should work as an alternative event listener:

    The DOMFrameContentLoaded event is executed when a frame has finished loading and being parsed, without waiting for stylesheets, images, and subframes to be done loading. This event is similar to DOMContentLoaded but only applies to frames.

    Firefox and Opera(Mini or desktop 12 and under which use the Presto Engine) support this event:

    Currently, Firefox and Opera both implement DOMFrameContentLoaded events.

    When a frame has been loaded, Opera dispatches an event on the owner iframe. This event then bubbles up to the window.

    Firefox dispatches an event on the document on the owner iframe. It bubbles to the window. The target of that element is the iframe whose content has loaded. If the owner document is itself contained in a frame, an event is dispatched to the parent document. event target is still the frame when content has loaded (and so on to the top of the parent document chain).

    References

    • Webkit Bug 33604 - iframe.contentWindow doesn't fire DOMContentLoaded (implement DOMFrameContentLoaded?)

提交回复
热议问题