How to find the URL of the current tab in a Chrome extension

It’s a little hard to find – getCurrent() returns the current hidden page for the extension.

chrome.tabs.getSelected(null, function(tab){
   var baseUrl = tab.url;
   console.log(baseUrl);
});

If you want a good Javascript book, I got a lot out of Secrets of the Javascript Ninja.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *