Hi! I am trying to get the current url or title of the chrome tab that I am on, from my chrome extension.
chrome.tabs.query (
{ currentWindow: true, active: true },
function(tabs) {
var activeTab = tabs[0];
var title = activeTab.title;
setMsg(JSON.stringify(activeTab));
});
setMsg just prints the results out to a div on my chrome extension. The string that it prints out for this page is
{"active":true,"height":341,"highlighted":true,"id":5726,"incognito":false,"index":14,"openerTabId":5722,"pinned":false,"selected":true,"status":"complete","width":1378,"windowId":1784}
but it does not print out the url or the title attributes of the object.
I added the "tabs" permissions to my manifest.json.
"manifest_version": 2,
"minimum_chrome_version": "16.0.884",
"name": "BuilderKit",
"permissions": [ "tabs", "clipboardWrite", "storage", "\u003Call_urls\u003E" ],
"short_name": "BuilderKit",
"version": "1"
}
But when I try to run this in order to check if the permission contains "tabs", it prints out "no go", which means that the extension does not have the "tabs" permission for some reason... Please refer to the code below:
chrome.permissions.contains({
permissions: ['tabs'],
}, function(result) {
if (result) {
setMsg("got it!");
} else {
setMsg("no go");
}
});
Why is the "tabs" permissions not recognized? Also, why is it that the url of the page and the title of the page are not available?