Is this possible for chrome extension to get all the URLs in all tabs using chrome extension ?
I have got the url of current Tab using this code
chrome.tabs.getSelected(null, function(tab) {
tabUrl = tab.url;
alert(tabUrl);
});
We need the following permissions in manifest.json file
"permissions": [
"tabs"
]
My question is to find out the URLs in all tabs ?
You could do something like this:
chrome.windows.getAll({populate:true},function(windows){
windows.forEach(function(window){
window.tabs.forEach(function(tab){
//collect all of the urls here, I will just log them instead
console.log(tab.url);
});
});
});
With chrome.tabs.query method, you can also simply do,
chrome.tabs.query({},function(tabs){
console.log("\n/////////////////////\n");
tabs.forEach(function(tab){
console.log(tab.url);
});
});