【发布时间】:2019-01-19 16:15:07
【问题描述】:
我正在尝试创建一个 chrome 扩展程序。 应用程序的目标: 打开新的弹出窗口并编辑内容和 html 但它不起作用 它在控制台中向我显示此错误:
未捕获的 DOMException:阻止了来源为“chrome-extension://pjnjcefdmacabhjhkkggfbcbdalfannl”的框架访问跨域框架。
manifest.json:
{
"manifest_version": 2,
"name": "Title!",
"description": "Description...",
"version": "1.0",
"browser_action": {
"default_icon": "images/email.png",
"default_popup": "popup.html",
"default_title": "Title",
"matches": ["*://*.*/*"]
},
"permissions": [
"webRequest",
"storage",
"*://*.*.*/*",
"activeTab"
],
"chrome_url_overrides": {
"newtab" : "popup.html"
},
"content_scripts": [{
"matches": [ "*://*.*/*" ],
"js": [ "script.js" ],
"all_frames": true
}]
}
script.js:(错误部分)
myWindow = window.open("https://gmail.com", "", "width=900, height=500");
myWindow.document.getElementById("elementId1").value = variable1;
myWindow.document.getElementById("elementId2").value = variable2;
我无法获取或更改值, 我尝试了很多网址,但它显示相同的错误
有什么帮助吗?
【问题讨论】:
-
我不这么认为,这不是我的问题,我的代码中没有包含 iframe
标签: javascript json google-chrome-extension manifest