在Chrome扩展程序中加载页面时内容安全策略错误?

时间:2014-07-21 13:39:45

标签: javascript jquery google-chrome google-chrome-extension

我正在尝试使用javascript加载网址。这些是我的代码:

var title;
chrome.tabs.onActivated.addListener( function(activeInfo){
  chrome.tabs.get(activeInfo.tabId, function(tab){
    y = tab.url;

   $.get(y, function(data) {
        var data = $(data);
         title = $("#div", data).attr("title");

        alert(title);
    });
  });
});

这是我的清单文件:

{"name": "PDFisolate",
 "description": "PDFisolate",
 "version": "0.1",
 "background": {"scripts": ["jquery-1.11.1.js","new.js"], "persistent": false},
 "options_page": "options.html",
 "permissions": ["downloads","tabs","activeTab"],
"content_scripts": [
  {
    "matches": ["http://ieeexplore.ieee.org/*"],
    "js": ["jquery-1.11.1.js","new.js"],
    "run_at": "document_start",
    "all_frames": true
  }
 ],
 "content_security_policy": "script-src 'self' chrome-extension-resource: 'unsafe-eval';content_scriptsect-src 'http://*' ;default-src 'self'" ,
 "manifest_version": 2}

但是当我加载扩展时,我得到了erorr:

Refused to connect to 'url' because it violates the following Content Security Policy directive: "default-src 'self'". Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback.

我该怎么办?我已经看到类似的问题,但由于我不是新手,因此无法解决问题。

0 个答案:

没有答案