Javascript Chrome扩展无法与window.open一起使用
我正在编写一个chrome扩展,它需要修改弹出窗口的html,该窗口会弹出javascript代码,如下所示:Javascript Chrome扩展无法与window.open一起使用,javascript,html,google-chrome,google-chrome-extension,window.open,Javascript,Html,Google Chrome,Google Chrome Extension,Window.open,我正在编写一个chrome扩展,它需要修改弹出窗口的html,该窗口会弹出javascript代码,如下所示: var myWindow = window.open("", "MsgWindow", "width=200, height=100"); myWindow.document.write("<p>This is 'MsgWindow'. I am 200px wide and 100px tall!</p>"); 当我打开一个普通网页时,我会看到一个标题为的警
var myWindow = window.open("", "MsgWindow", "width=200, height=100");
myWindow.document.write("<p>This is 'MsgWindow'. I am 200px wide and 100px tall!</p>");
当我打开一个普通网页时,我会看到一个标题为的警告对话框。但是,当我使用javascript代码窗口.open
时,没有警报
我怎样才能让扩展也在弹出页面上工作
谢谢尝试包含您的
窗口。在清单中的JS
数组中打开JS文件。window.open位于另一个网页上,而不是扩展的一部分。抱歉,如果这是不明确的,如果它不是扩展的一部分,它如何运行?用户单击一个按钮,打开弹出窗口。我希望扩展在新打开的窗口上运行。请查看以下内容:
{
"name":"PresentIT",
"description":"Connects Google Drive to PresentIT",
"version":"0.1",
"manifest_version":2,
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["script.js"]
} ]
}
alert(document.title);