我想在我的Chrome扩展程序中添加一个类似facebook的按钮,但在尝试此操作时出错。 这是我的清单文件:
{
"name": "XXXXX",
"manifest_version": 2,
"version": "1.9",
"icons": { "128": "images/xxx.png" },
"background": {
"scripts": ["background.js"],
"page": "background.html"
},
"permissions": [
"tabs","bookmarks",
"http://*/*",
"https://*/*"],
"background": { "page": "background.html"},
"web_accessible_resources": [
"images/info.png"
],
"browser_action": {
"default_title": "Xxx",
"default_icon": "images/xxxx.png",
"default_popup": "list.html"
}
}
这是我要添加的框架:
<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Fplugins%2F&width&layout=standard&action=like&show_faces=true&share=true&height=80&appId=229499750441210" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:80px;" allowTransparency="true"></iframe>
我应该怎么做以克服以下错误:
GET chrome-extension://www.facebook.com/plugins/like.php?href=https%3A%2F%2Fdev…ard&action=like&show_faces=true&share=true&height=80&appId=229499750441210 net::ERR_FAILED
答案 0 :(得分:2)
请注意它是如何尝试使用chrome-extension://www.facebook.com
作为网址的?这是因为使用//
启动URL会告诉浏览器使用当前协议。由于Chrome扩展程序使用协议chrome-extension
,因此无效。
尝试将iframe更新为
<iframe src="https://www.facebook.com/plugins/like.php?href=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Fplugins%2F&width&layout=standard&action=like&show_faces=true&share=true&height=80&appId=229499750441210" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:80px;" allowTransparency="true"></iframe>