chrome 扩展注入的 iframe 不工作
chrome extension-injected iframe is not working
我有一个名为 iframeInjector 的 js
var iFrame = document.createElement ("iframe");
iFrame.src = chrome.extension.getURL ("http://google.com");
document.body.insertBefore (iFrame, document.body.firstChild);
比我有这个清单:
{
"manifest_version": 2,
"content_scripts": [ {
"js": [ "iframeInjector.js" ],
"matches": [ "https://*/*","<all_urls>"
]
} ],
"description": "Inject a google site",
"name": "Inject google",
"version": "1",
}
但是当我打开站点 iframe url 时,它是 chrome-extension://dhnpacpfjbnmnbefjlfgemkphjilciak/http://google.com。
我做错了什么?
chrome.extension.getURL
仅适用于本地资源。您不需要将它用于 HTTP 链接。
然而,Google expressly disallows embedding into iframes。它会在一个帧中检测运行,并且不会工作。
我有一个名为 iframeInjector 的 js
var iFrame = document.createElement ("iframe");
iFrame.src = chrome.extension.getURL ("http://google.com");
document.body.insertBefore (iFrame, document.body.firstChild);
比我有这个清单: { "manifest_version": 2,
"content_scripts": [ {
"js": [ "iframeInjector.js" ],
"matches": [ "https://*/*","<all_urls>"
]
} ],
"description": "Inject a google site",
"name": "Inject google",
"version": "1",
} 但是当我打开站点 iframe url 时,它是 chrome-extension://dhnpacpfjbnmnbefjlfgemkphjilciak/http://google.com。 我做错了什么?
chrome.extension.getURL
仅适用于本地资源。您不需要将它用于 HTTP 链接。
然而,Google expressly disallows embedding into iframes。它会在一个帧中检测运行,并且不会工作。