0

I wanna use the localstorage per page (file name), instead of domain/subdomain. With some reasons that I could not rename the localstorage variable, they must use the same variable name. How can I use the localstorage seperately for different pages in same domain? Fake domain name? Encrypted the url?

Thanks.

Siri How
  • 87
  • 2
  • 9
  • possible duplicate of [In HTML5, is the localStorage object isolated per page/domain?](http://stackoverflow.com/questions/4201239/in-html5-is-the-localstorage-object-isolated-per-page-domain) – Thilo Jun 20 '14 at 03:23
  • Sounds like a matter of organization. Why not store an object with properties for each page? – Kai Qing Jun 20 '14 at 03:25
  • As my html has third-party function which used localstorage. I cannot change the code. So suffering... – Siri How Jun 20 '14 at 03:33

1 Answers1

0

No, it is only available per domain.

What you can do is give every page their own key prefix in the shared storage area. But you have to make all scripts from your domain cooperate nicely and not step on each-other by yourself. No automatic isolation.

Thilo
  • 241,635
  • 91
  • 474
  • 626