Disable multiple tabs in browser

Currently in Vaadin 7, it is possible to open multiple tabs for single session using multiple UIs.

Is it possible for the VaadinSession to use only one UI / tab? Thank you.

Hello!

Just curious, why do you want to do that? I started thinking about a solution, but I don’t understand what the behavior could be when you close the only one tab that you’re allowed to use?

If you want to prevent the user to open a new tab, you could apply the following strategy: raise a flag in the session when the first UI inits, and then for other tabs display an error message instead of the real UI.

So your UI code might look like this:

[code]
public MyUI extends UI {
public init(…) {
if (VaadinSession.getCurrent().getAttribute(“hasUI”) != null) {
setContent(new Label(“Use only one tab!”));
return;
}

    VaadinSession.getCurrent().setAttribute("hasUI", Boolean.TRUE);

    // ... create your ui ...
}

}
[/code]You’ll need to think what to do with the app when the first UI is closed. It will take some time before the session dies and you get a new UI.