Chrome extension not working with window.open

I am writing a chrome extension that is supposed to change the html of a popup that pops up with javascript code like:

var myWindow = window.open("", "MsgWindow", "width=200, height=100");
myWindow.document.write("<p>This is 'MsgWindow'. I am 200px wide and 100px tall!</p>");

      

This javascript code is on another website and I want the extension to run on popup.

In manifest.json I have

{
    "name":"PresentIT",
    "description":"Connects Google Drive to PresentIT",
    "version":"0.1",
    "manifest_version":2,
    "content_scripts": [
    {
        "matches": ["<all_urls>"],
        "js": ["script.js"]
    } ]
}

      

and script.js I

alert(document.title);

      

When I open a regular web page, I get a dialog with a title bar. However, when I use javascript code window.open

, there is no warning.

How can I get the extension to work on the popup page?

thank

+3


source to share





All Articles