Creating an iframe in Firefox extension code
if (Components && Components.classes) { | |
// This means we are in a Firefox extension. | |
var appShell = Components.classes["@mozilla.org/appshell/appShellService;1"] | |
.getService(Components.interfaces.nsIAppShellService); | |
// hiddenDoc will now point to a regular DOM document. | |
var hiddenDoc = appShell.hiddenDOMWindow.document; | |
// Create an iframe. | |
let iframe = hiddenDoc.createElementNS("http://www.w3.org/1999/xhtml", "iframe"); | |
iframe.setAttribute("mozframetype", "content"); | |
hiddenDoc.documentElement.appendChild(iframe); | |
// Load a page in it. | |
iframe.setAttribute("src", "http://google.com"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
gokul01it commentedApr 21, 2015
Could you please answer me the below queries?
How use this js file in webpages?
How to create extension out of it?