Manually dispatchEvent DOMContentLoaded
This works for me in Firefox:
var DOMContentLoaded_event = document.createEvent("Event")
DOMContentLoaded_event.initEvent("DOMContentLoaded", true, true)
window.document.dispatchEvent(DOMContentLoaded_event)
Since initEvent
is deprecated here, it's better to use Event
constructor like this:
window.document.dispatchEvent(new Event("DOMContentLoaded", {
bubbles: true,
cancelable: true
}));