Skip to main content
Known Participant
October 14, 2010
Question

keep variable value for a new browser tab

  • October 14, 2010
  • 2 replies
  • 487 views

How to keep (save) a variable value so that its value is still available in a new browser tab?

e.g.

In the original browser window, the lang variable is "en".

After a new browser tab is opened, the lang variable is still "en" in the new browser tab.

This topic has been closed for replies.

2 replies

BKBK
Community Expert
Community Expert
October 16, 2010

I would have two alternatives, depending on whether the variable has to apply to each user or to the whole application.

1) If the lang variable applies to each user, I would store it in client scope or in session scope. One implication is that the application should have been set up to use client-management and session-management. An alternative is to  store it as a cookie.

2) If the lang variable applies to the application as a whole, I would store it in application scope.

Passing the variable as a URL or form variable requires an event, for example, a link or button. However, that may not be a practical way to navigate between tabs.

Owainnorth
Inspiring
October 14, 2010

Use an URL variable in the link (assuming they're clicking a link on your site to open a new tab) or use a Client or Session variable if the second tab is a page under the same domain.