Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancment: use window.name as fallback #25

Closed
tilman opened this issue Mar 14, 2021 · 5 comments
Closed

Enhancment: use window.name as fallback #25

tilman opened this issue Mar 14, 2021 · 5 comments

Comments

@tilman
Copy link

tilman commented Mar 14, 2021

Hey, just wanted to discuss the Idea of using window.name as a fallback instead of a global variable.

window.name would have the advantage of being persistent for the whole javascript session (in particular for a page reload; but not across tabs) and is still available even if cookies are turned off.

If you think that would be a better solution I would be happy to create a merge request.

Here is some more information about window.name:
https://www.thomasfrank.se/sessionvars.html

@astoilkov
Copy link
Owner

That's an interesting idea. I didn't know window.name worked like that. Can you help me by answering some questions?

  • When window.name is lost?
    • What about the different ways to refresh the page: using the address bar, using Reload Page, using Force Reload Page?
  • Is the behavior of window.name consistent between browsers?
  • Do you know some libraries that use window.name for persisting data?
  • Is it secure? Do iframes have access to the value?

@kolben
Copy link

kolben commented May 4, 2021

https://developer.mozilla.org/en-US/docs/Web/API/Window/name

Wouldn't recommend it 😄

@astoilkov
Copy link
Owner

@kolben I read the article. Thanks.

Why you wouldn't recommend it? What are the reasons? Thanks.

@kolben
Copy link

kolben commented May 5, 2021

  • The original article linked is 13 years old.
  • The frameworks referenced in the mdn article are long gone and the article clearly says it shouldn't be used to store user data
  • window.name will very soon no longer be available across tabs/ windows

@astoilkov
Copy link
Owner

@kolben Yep. That's pretty definitive. Closing this issue then. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants