【问题标题】:chrome extension-injected iframe is not workingchrome 扩展注入的 iframe 不起作用
【发布时间】:2015-04-19 16:46:44
【问题描述】:

我有一个叫做 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。 我做错了什么?

【问题讨论】:

    标签: google-chrome-extension


    【解决方案1】:

    chrome.extension.getURL 仅用于本地资源。您不需要将它用于 HTTP 链接。

    但是,Google expressly disallows embedding into iframes。它会检测在一个框架中运行,并且不会工作。

    【讨论】:

    • 是的,就是这样。快速响应。
    猜你喜欢
    • 2013-10-12
    • 2016-10-09
    • 2023-03-08
    • 2012-08-15
    • 2018-05-03
    • 1970-01-01
    • 2012-03-09
    • 2015-02-28
    • 2013-12-24
    相关资源
    最近更新 更多