1

Uniquely identify every separate browser window that is currently open using JavaScript or jQuery?

How to uniquely identify every separate browser window that is currently open for all major browsers using javascript? Let me explain what I need to know and let's consider the scenario below:

I have 3 browser windows [any modern browser, i.e. Chrome, Firefox etc.] that are currently open, each containing multiple tabs.

  • Window #1: 3 tabs [Tab A, Tab B, and Tab C]
  • Window #2: 2 tabs [Tab D and Tab E]
  • Window #3: 4 tabs [Tab E, Tab F, Tab G, and Tab H]

How can I uniquely identify each browser window [i.e. capture a unique ID/value for each browser window, not the tab's window]? So, at the end I will have 3 IDs [all windows], not 9 IDs [all tabs]. I am able to identify all the tabs in the windows by creating a browser add-on or extension which uses jQuery [crossrider], but could not find a way to uniquely identify each window.

Is this possible by JavaScript/JQuery? If so, how? if not, why?

I tried "window.name" in javascript, but that gives me 9 IDs, not 3 IDs.

Ali007
  • 648
  • 1
  • 12
  • 20
  • Do you want to know the number of tabs opened in chrome from firefox or same Browser ? i used localStorage to identify tabs. – Red Nov 04 '13 at 11:49
  • I just need to identify each opened browser window. The solution should be a javascript solution [i.e. window.name or something like this in javascript or jquery] to identify the browser windows for all the major browsers. – Ali007 Nov 04 '13 at 12:58
  • @Red how did you identify number of tabs using localStorage ? – DevT Jul 16 '14 at 11:17

1 Answers1

1

Can I pass a JavaScript variable to another browser window?

Is probably what your looking for, Specifically this part of the Open() method:

Each window created in such a way gets a property applied to it "window.opener" pointing to the window which created it.

Community
  • 1
  • 1
calcazar
  • 1,120
  • 1
  • 12
  • 22
  • I want to save the user's browsing session [currently opened windows and tabs] to the cloud/server on button click by user so that the user can leave/close his/her browser/computer, come back again and start browsing where he/she left off. For example, when Chrome crashes, it remembers user's last session and reopens all the windows and tabs exactly the way they were opened before the crash so that users don't have to reopen them again. In this scenario, I don't want to save/open 9 tabs in 1 window, but 3 tabs in window #1, 2 tabs in window #2, and 4 tabs in window #3. – Ali007 Nov 05 '13 at 00:20