I’m getting an Uncaught SyntaxError: Unexpected identifier on the first line for this snippet of code. I’m new to JavaScript so it’s probably something very simple that I’m missing.
chrome.tabs.getSelected(function(Tab tab) {
var url = tab.url;
console.log(url);
});
console.log("test");
JavaScript doesn’t have static type declarations; when the Chrome docs tell you
Tab tabthat’s just for your information, not what you’d actually write in JS.Also you’re missing an argument to the
getSelectedmethod.