Reply
New Member
Posts: 2
Registered: ‎07-05-2018

background.js Uncaught TypeError Cannot read property 'onClicked'

[ Edited ]


I tried all from this question I found but I still get the error Why is chrome.browserAction.onClicked undefined?

background.js:2 Uncaught TypeError: Cannot read property 'onClicked' of undefined at background.js:2 at background.js:15

I add my background.js to background field, I added a browser action section and set the persistent to true. What else can I try?

my manifest file

{
"update_url": "

"manifest_version": 2,

"name": "CSV Export for Avnet",
"short_name": "CSV Avnet",
"description": "CSV export for Avnet",
"version": "0.1.0",
"browser_action": {
"default_title": "CSV for Avnet export"
},
"background": {
"scripts": ["background.js"],
"persistent": true
},

"icons": {
"16": "images/avent-64.png",
"48": "images/avent-64.png",
"128": "images/avent-64.png"
},

"permissions": [
"activeTab"
]
,
"content_scripts": [
{
"matches": ["*://*.avnet.com/*"],
"js": ["jquery.min.js", "background.js"]
}
]


}
also my background.js if it helps

(function (){
chrome.browserAction.onClicked.addListener(function(tab) {
"use strict";
chrome.tabs.executeScript(
{ file: 'lib/utils.js' },
function(){
chrome.tabs.executeScript({ file: 'lib/trello.js'},
function(){chrome.tabs.executeScript({
file: 'csv.js'
});
});
}
);
});
})();Gmail Login AnyDesk Google Play Services