Distinguish browser tabs

Hi, i have a generall question.
It seems to me (even if i dont know how i could be technical implemented, since session are the same and HTTP is stateless), that vaadin is able to differ diffrent browser tabs or browser window instances, even if they all have the same session.

For example: My vaadin application has a simple authentication mechanismus (switching main window with Application.setMainWindow(…) ). So lets assume I have two Windows:

  • loginWindow
  • contentWindow

and contentWindow is displayed after the login has been succssful. contentWindow initially displays the startView and by clicking on a button it shows me the anotherView.

So far so good, now i try this:

  1. I run my vaadin app in Firefox Window #1, sign in and click in the contentWindow on the button to display anotherView instead of the initial view.

  2. Now I’m starting a new Firefox Window #2 with the same URL as Window #1. As Firefox Window #1 and Firefox Window #2 share the same session Firefox Window #2 displays the contentView instead of the loginView. But Firefox Window #2 show me the initailView and not the same view (you may call it state) as Firefow Window #1, which is displaying anotherView.

My question is:
Is there a built-in mechanimus to differ Firefox Window #1 and Firefox Window #2 ? If yes, is there a possiblitiy to use this via an API? My understanding of the Vaadin architecture is that server and client have the same “state”, but im not sure if this is correct.

Aside from using different URLs for each browser window, there is one other way of telling them apart. That’s by assigning a unique value to the JavaScript window.name variable and then keeping track of which Vaadin Window corresponds to which window.name.

There is no API for accessing this data in Vaadin 6, though it could surely be done using some custom client-side code with the limitation that the data would only be available on the server after already rendering the initial view.

Vaadin 7 already uses the same technique to implement Application.setRootPreserved. See
https://vaadin.com/wiki/-/wiki/Main/Creating%20an%20application%20that%20preserves%20state%20on%20refresh
for an example.

Does this help you?


https://vaadin.com/web/joonas/wiki/-/wiki/Main/Supporting+Multible+Tabs

That shows how to create separate windows in the same session, and each window has state separate from the others.

Cheers,
Bobby