Search code examples
javascriptcontent-scriptmicrosoft-edge-extension

Embed iframe created in a js file in current web page when clicked on IE edge extension


I am trying to create a IE edge extension where in I want to embed a iframe (created in javascript file) in current web page when clicked on extension icon. I know we need to make use of content scripts but unable to understand how to inject them in another js. I am new to extensions as well as js. Can someone please help me.


Solution

  • Please go through the documentation here regarding tabs.executeScipt (https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/tabs/executeScript). Using this API you will be able to inject JS into the content page (webpage). The same can be used to inject an IFRAME into the page.