I want to get url for use it in variable with an chrome extension. I read here this code :
chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) { var tabURL = tabs[0].url; console.log(tabURL); }); but it doesn't work on this url
http://sail.zezo.org/clipperton-noumea/chart.pl?lat=-15.93361&lon=-176.0022&userid=1577252
manifest.json:
{ "manifest_version": 2, "name": "Route zezo.org", "version": "1.0", "description": "Extraire la route proposée", "permissions": [ "http://sail.zezo.org/*", "tabs" ], "icons": { "16": "icon-16.png", "48": "icon-48.png", "128": "icon-128.png" }, "browser_action": { "default_icon": "icon.png", "default_popup": "popup.html" } } I don't understand where I make a mistake ...
(Sorry for my bad English ...)
Inspectand you'll see the console. Also, make sure to use the variable only inside the callback as chrome.* API is asynchronous.chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) { var tabURL = tabs[0].url; });