Keep variable persistent on multi page using javascript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Keep variable persistent on multi page using javascript

hello everyone, I have two pages and I want so to keep the value of var somvar on of page 1 to the page 2. every page is JavaScript page.

19th May 2017, 8:58 AM
Didier Lasme
Didier Lasme - avatar
2 Answers
+ 2
I don't think you can create global variable across the pages. Use PHP session or cookie to achieve that. Or you can try to design all the contents of the pages in a single-page webpage
19th May 2017, 9:44 AM
Calviղ
Calviղ - avatar
0
thank you for answer it. I have a single page but I use pagination , so I want to keep some variable persist in every pagination page.
20th May 2017, 11:35 AM
Didier Lasme
Didier Lasme - avatar