0
感謝您花時間閱讀本文。 這是我的擴展文件夾的目錄。Chrome擴展程序無法正常工作(出現權限錯誤?)
這裏是清單代碼:
{
"manifest_version": 2,
"name": "Technobuffalo Stories",
"description": "Your Description about Extension goes here",
"version": "1.0",
"content_scripts": [ {
"js": [ "popup.js" ],
"matches": [ "http://feeds.feedburner.com/*" ]
} ],
"permissions": [ "http://feeds.feedburner.com/*" ],
"browser_action": {
"default_icon": "icon_16.jpeg",
"default_popup": "popup.html"
}
}
這裏是popup.html:
<html>
<head>
<title>Technobuffalo Stories
</title>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script src="popup.js"></script>
</head>
<body>
<div id="feed" style="background-color:orange;height:500px;width:500px;" ></div>
</body>
</html>
和最後都在這裏被popup.js:
的google.load(」飼料「,」1「);
function initialize() {
var feed = new google.feeds.Feed("http://feeds.feedburner.com/technobuffalo/rss?format=xml");
feed.load(function(result) {
if (!result.error) {
var container = document.getElementById("feed");
for (var i = 0; i < result.feed.entries.length; i++) {
var entry = result.feed.entries[i];
var div = document.createElement("div");
div.appendChild(document.createTextNode(entry.title));
container.appendChild(div);
}
}
});
}
google.setOnLoadCallback(initialize);
當我打開popup.html文件,因爲它是,顯示所需的結果,但是當我加載瀏覽器擴展,只有div的背景顏色可以看出。我設置的權限是否存在任何問題,或者是否有其他問題?
謝謝, Yash。
https://developer.chrome.com/extensions/contentSecurityPolicy.html –