I'm building a chrome extension that submits links to an aggregation website. In order to do this, I need to get the URL from the currently open window, which I'm trying to do with this code:
chrome.tabs.query({'active': true, 'lastFocusedWindow': true}, function (tabs) {
var url = tabs[0].url;
...
});
This works fine with only one window open, but it seems to select the active tab from the first opened window when I have more than one open, rather than from the last focused window. I have tried using currentWindow also, but that seems to have the same problem.
Any help would be greatly appreciated!