Chrome拡張機能を構築しようとしています。ユーザー名の背景画像の URL を取得し、ページに配置します。しかし、予期しないエラーが発生します。エラーテキストは次のとおりです。
https://twitter.com/jackのページは、 http://api.twitter.com/1/users/show.json ?screen_name=jack&callback=jQuery18207089675806928426_1351333462593&_= 1351333462594 からの安全でないコンテンツを実行しまし た。
Uncaught ReferenceError: jQuery18207089675806928426_1351333462593 が定義されていません (無名関数)
拡張フォルダーには、次のファイルが含まれています。
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:
<html>
<head>
<script type="text/javascript" src="/javas.js"></script>
</head>
<body>
</body>
</html>
jquery.min.js はhttp://code.jquery.com/jquery-1.8.2.min.jsから取得されます
マニフェスト.json:
{
"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
}
]
}