Home > Back-end >  change localstorage by changing url without changing site
change localstorage by changing url without changing site

Time:09-17

I have a github pages site which displays user provided images, and uses localstorage for the images and settings. So far it's worked fine, but I'd like to be able to have multiple instances of this site open simultaneously with different settings. I had initially thought to use ?instance=name or #instancename to decide which instance to load but then it tends to exceed localstorage size with all the images. So my question is, how can I change the url so that the same page is loaded but with a different instance of localstorage?

For reference, here's the code: https://github.com/josephsmendoza/PNGTube/blob/main/index.html

And this is the url in question: https://josephsmendoza.github.io/PNGTube/

CodePudding user response:

You cannot

Local storage is shared for any webpage with the same left side of the first /. For example, https://josephsmendoza.github.io/PNGTube/ will have the same localstorage as https://josephsmendoza.github.io/PNGTube?a=b or https://josephsmendoza.github.io/PNGTube/something or https://josephsmendoza.github.io/another-project.

  • Related