Skip to content Skip to sidebar Skip to footer

Get Urls Of All Open Tabs In Chrome, And Send It To A Web Service

I am making a chrome extension to get urls of all open tabs and save them all to send them to a domain.so i require 2 steps: Get urls of all open tabs and store them in an array o

Solution 1:

Look at chrome.windows.getAll to get a list of open windows. Each window has a tabs property that contains a list of tabs in the window. Each tab has a url property. See tabs documentation.

You'll want to loop over the windows, and then the tabs in each window, and add these to your array and then do whatever it is you want to do.

Normally you can't do this, but chrome extensions with the necessary permissions are allowed to do Cross-Origin XMLHttpRequest. You'll need that to send the list to the other domain.

You can use JSON.stringify to convert an array to a string that you can send and then some similar function on the server side to convert it back to an array.


Post a Comment for "Get Urls Of All Open Tabs In Chrome, And Send It To A Web Service"