Get Chrome Tabs Information

Helpful tutorials about how to create Chrome Extensions
1 post Page 1 of 1
Contributors
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4389
Joined: Tue Aug 04, 2009 1:47 am

Get Chrome Tabs Information
CodenStuff
Hello Coders,

The following code will allow you to grab all the tabs open in Chrome and use their information.

Following Danny simple extension getting started tutorial here: http://www.codenstuff.com/forum/viewtop ... 272&t=8264
Code: Select all
    //GET LIST OF TABS URLS
    chrome.tabs.query({}, function (tabs) {
        tabs.forEach(function (tab) {
			/*Do what you need to here in order to use the tab information
			EAXMPLE:
			tab.favIconUrl = Get the tabs favicon
			tab.url = Get the tabs current URL
			new URL(tab.url).hostname = Get the tabs hostname/domain
			*/
        });
    });
You would place the above code in your popup.js file.

I have attached a simple example extension for you to download and play with.
ChromeTabInfo.zip
Happy coding :)
You do not have the required permissions to view the files attached to this post.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
1 post Page 1 of 1
Return to “Tutorials”