javascriptobjectdomcontentloaded

DOMContentLoaded on DOM <object> doesn't work in Edge


To get the DOMContentLoaded event of an included object like this

<object class="emb" data="./probe-object.html" width="100" height="100" type="text/html">

works in Chrome and Firefox with the following code, but not Edge.

let includedObject = document.querySelector(".emb object");
includedObject.contentWindow.addEventListener('DOMContentLoaded', function() {
    includeObject();
});

How can I do something similar in Edge?


Solution

  • If

       includedObject.contentWindow.addEventListener
    

    is replaced with

       includedObject.contentDocument.addEventListener
    

    it works in Edge, but not in Edge nor Firefox. This seems like an Edge bug.