我正在尝试了解Chrome扩展程序,我想我错过了一些东西。我想使用后台脚本上传文件......这是我的清单:
"manifest_version": 2,
"name": "myTest",
"description": "Upload file",
"version": "0.1",
"icons": {
"64": "64.png",
"16": "16.png",
"32": "32.png",
"128": "128.png"
},
"background":{
"scripts": ["justupload.js"],
"persistent": true
},
"content_scripts": [
{
"matches": ["http://my.url/page.html"],
"js": ["link.js"]
}
],
"permissions": [
"http://my.url/page.html","background"
]
和link.js
function sendbg(){
var BGPage = chrome.extension.getBackgroundPage();
BGPage.senddata(document.getElementById('files'));
}
document.getElementById('files').addEventListener('change', sendbg, false);
文件更改时,我收到以下错误:
Uncaught TypeError: Object #<Object> has no method 'getBackgroundPage'
由于