Scope of session with multiple browser tabs


#1

Hi All,

If a user opens multiple browser tabs (eg by ctrl-clicking a link) within a Meteor application, does the Session Object span multiple tabs, or does each tab have it’s own Session?

For example, I’ve seen samples where a Session variable determines whether a modal window is visible or not. If the user was initiating modal dialogs in the first browser tab, would the modal pop ups show in the next browser tab if it were pointing to the same page/url?

Thank you.


#2

The Session object does not normally cross tab/window boundaries and changes will only affect the current page and will not be persisted across page reloads but will be persisted across hot code pushes. You can however use a package like u2622:persistent-session which will save your Session objects state to localstorage thereby persisting it across page refreshes and crossing tab/window boundaries due to the way localstorage works.


#3

That’s what I hoped. Thank you!