我正在开发一个 Chrome 扩展程序,它将根据以下清单加载内容脚本:
"content_scripts" : [
{
"matches" : [ "<all_urls>" ],
"js" : [ "scripts/namespace/namespace.js",
"scripts/log/Logger.js"]
"run_at" : "document_start",
"all_frames" : true
}
]
有一个样机站点,其 HTML 为:
<html>
<head>
<script language=javascript>
var test;
function makewindow() {
test=window.open('mywin');
test.window.document.write("<html><body><A onclick=window.close(); href= > click Me to Close</A>");
test.window.document.write(" ---- </body></html>");
}
</script>
</head>
<body>
<a href="" onclick="makewindow();return false;" >Click me to launch the external Window</a>
</body>
</html>
如果我单击 A 链接,它将运行makewindow
功能并弹出一个新窗口。
新窗口的 URL 是about:blank
,并且内容脚本没有加载到这个新窗口中。
如何在这个新窗口中加载内容脚本?