我正在嘗試構建一個Chrome擴展。它將用戶名的背景圖片網址放到頁面中。但它會帶來意想不到的錯誤錯誤文本是:Chrome:Uncaught ReferenceError jQuery沒有定義
The page at https://twitter.com/jack ran insecure content from http://api.twitter.com/1/users/show.json?screen_name=jack&callback=jQuery18207089675806928426_1351333462593&_=1351333462594 .
Uncaught ReferenceError: jQuery18207089675806928426_1351333462593 is not defined (anonymous function)
擴展文件夾包含以下文件:
action.js // background.html // jquery.min.js // manifest.json
action.js:
var userPage = document.URL;
var arr = userPage.split("/");
var username = "";
for(i=3;i<4;i++)
username += arr[i];
var page = "http://api.twitter.com/1/users/show.json?screen_name="+username+"&callback=?";
background();
function background() {
$.getJSON(page, function(data) {
$("span.screen-name").append(" • <a href='"+data.profile_background_image_url+"'>B</a> • ");
});
}
background.html:
{
"name": "Twitter Background",
"version": "1.0",
"background_page": "background.html",
"description": "Puts the background image url to the profile page.",
"content_scripts": [
{
"matches": ["http://twitter.com/*","https://twitter.com/*"],
"js": ["jquery.min.js","action.js"],
"all_frames":true
}
]
}