Using a Session Cookie, which will expire when the browser is closed.
Using SessionStorage, which will expire when the tab is closed.