I cannot figure out why I am getting returned the error Cannot read property 'query' of undefined. The error is thrown and the user is unable to click on any of the buttons.
JSON:
{
"name":"Jira Extension",
"version":"1.0",
"description":"Allow for quick access to changing SD and TA",
"permissions":[
"activeTab",
"tabs"
],
"browser_action": {
"default_popup": "popup.html"
},
"background":{
"persistents": false,
"scripts": ["background.js"]
},
"options_page":"options.html",
"manifest_version":2
}
Javascript:
chrome.tabs.query({'active': true, 'currentWindow': true}, function (tabs) {
var url = tabs[0].url;
var project = url.replace("https://jira2dev.cerner.com/browse/", "");
document.getElementById("demo").innerHTML =
"Current Project: " + project;
});
I would like the code to return the current project the user is on whilst being able to use the code. The error does not allow the user to press any keys further on the extension.