Im new to JS and was wondering if it is possible to write a script which would collect the data of all open tabs and display it.
Asked
Active
Viewed 2,597 times
0
-
No, for obvious security and privacy reasons. Unless by "script" you mean browser extension. – Guy Incognito Jun 21 '20 at 21:19
-
Your question seems to be way too broad for StackOverflow. You should look for scraping in general in Google, get to know the best tools available to do what you want to do, and then search for specific questions whenever you're in trouble. If they have not been asked yet, then you can ask ;-) Welcome to StackOverflow! – Thanh-Quy Nguyen Jun 21 '20 at 22:07
-
If all of the tabs are on the same domain, you can save a list of tabs in [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) and update the list whenever a tab is opened or closed. – Anderson Green May 03 '22 at 12:48
2 Answers
1
There is currently no way of controlling the data of browser tabs or other browser tabs with Javascript but there are some other things you can do with tabs like going to the nth tab of a window.open()
array.
Check out this StackOverflow answer

shreyasm-dev
- 2,711
- 5
- 16
- 34

Clarance Liberiste Ntwari
- 3,361
- 2
- 25
- 37
0
I don't think there is a way of accessing data from a tab in a browser because of a sandbox that separates the Javascript running in a thread on the webpage and the user's computer. If you were hoping to use this in a Google Chrome extension, this is possible. It's called chrome.windows.getAll()
, you can learn more about it at https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/windows/getAll.

shreyasm-dev
- 2,711
- 5
- 16
- 34

nedy
- 61
- 1
- 5