0
我想了解有關鉻擴展,我想我缺少的東西。我想用背景腳本上傳文件...這裏是我的清單:有沒有方法getBackgroundPage
"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'
謝謝