在我的扩展中打开网页时,window.open返回null

时间:2017-07-06 21:33:45

标签: javascript window.open

我正在使用firefox的webextension,并使用window.open打开报告页面。这是我的代码:

var reportURL = browser.extension.getURL("pages/report.html");
console.log(reportURL);
var myWindow = window.open(reportURL);
console.log("window.document");
console.log(myWindow);

窗口已成功打开,但myWindow仍为null。我想知道为什么会这样。非常感谢你!

1 个答案:

答案 0 :(得分:0)

这是Firefox的限制,因为扩展页面和打开的窗口在不同的浏览器进程中运行。请参阅bug 1466347