Insert an iFrame and then load it before other content on FF

I have browser plugins that insert an iframe into a webpage. An IFrame is inserted as early as possible (using DOMContentLoaded) so that the contents of the iframe are displayed with the page.

This does not happen in Firefox. Although the iframe seems to have been inserted before, the contents of the page / images / etc are loaded to the contents of the iframe.

Is there a way around this Firefox behavior so that iframe content can load earlier or earlier?

Not sure if that matters, but here are two methods with equivalent results:

Method 1. Insert iframe on DOMContentLoaded

Method 2:

nsiWebProgressListener()

onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
   const STATE_START = Components.interfaces.nsIWebProgressListener.STATE_START;
   const STATE_STOP = Components.interfaces.nsIWebProgressListener.STATE_STOP;

   if (aStateFlags & STATE_STOP) { //document is undefined at STATE_START

       try {
           //create iframe

       } catch (e) {}
   }
return true;
},
+3
source share
1 answer

DOMContentLoaded , FF. Firefox onLocationChange ( URL) setTimeout, 50 .

0

Source: https://habr.com/ru/post/1781208/


All Articles