Created
August 17, 2013 19:36
-
-
Save mixu/6258404 to your computer and use it in GitHub Desktop.
Get a JSON structure with all your open tabs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Needs to be run in the context of an extension with the "tabs" permission. | |
chrome.tabs.query({}, function(tabs) { | |
var byWindow = {}; | |
tabs.forEach(function(t) { | |
if(!byWindow[t.windowId]) { | |
byWindow[t.windowId] = [] | |
} | |
byWindow[t.windowId].push(t.url); | |
console.log(JSON.stringify(byWindow, null, 2)); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment