Skip to content

Is it possible to set localStorage or Session variable in page and read it in javascript on the other page?

As in question. Is it possible to set variable in page in localStorage and retrieve it on the other page?

How to set localStorage variable in Is it possible? After that I could read variable using:




I guess You can’t. The whole point of local storage is that it is local and You can manipulate it only from javascript. If You need to pass values between server and client You need to use some transport technology – cookies, ajax calls, hidden fields etc. It will all depend on how your application is organized, what kind of information is being stored, its volume, whether you want to redirect or not, but in all cases this should be done using javascript since that’s the only way to access data stored in localStorage.

2 People found this is helpful