javascript - How to add an iframe to the content / DOM using a firefox extension? -


I am trying to add an iframe to the contents of a webpage / DOM by using the Firefox extension.

Here's my code:

  const XUL = namespace ("axle", "http://www.mozilla.org/keymaster/gatekeeper/there.is. Only.xul "); Function addIframe (src) {// Create script node iframe = document.createElementNS (XUL, "iframe"); Iframe.setAttribute ("src", src); Window.content.appendChild (iframe); }   

This is a modified version from this answer:

I replaced this line:

  // it's top-document Level element of document.documentElement.appendChild (script);   

From this line:

  window.content.appendChild (iframe);   

Because it was inserting the iframe into the browser's Chrome and not the DOM in the content area. What is the correct order to insert it into a page? (My command is not working)

And the correct answer ... I go! const XUL = Namespace ("Axel", "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); Function addIframe (src) {// Create script node iframe = document.createElementNS (XUL, "iframe"); Iframe.setAttribute ("src", src); Window._content.document.body.appendChild (iframe); Return; }

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -