+ 3

How can I use local storage to transfer info between 2 HTML pages?

I got 2 different HTML pages, one is a quiz page the other one supposed to show first name, last name, student ID, scores..., how can I get the info that was input on the quiz page to appear on the result page?

26th Apr 2018, 7:09 PM
Kris V
6 Answers
+ 14
localStorage.getItem('label') localStorage.setItem('label', 'value')
26th Apr 2018, 8:24 PM
Baraa AB
Baraa AB - avatar
+ 6
Unfortunately (last I checked) LocalStorage doesn't work here in app webviews so it's hard to test. This link might be a good match though: https://www.codediesel.com/javascript/sharing-messages-and-data-across-windows-using-localstorage/
26th Apr 2018, 8:06 PM
Kirk Schafer
Kirk Schafer - avatar
+ 6
a sample code to show alert only once for page using localStorage ,but serves as a good example as Kirk said it won't run on SoloLearn though https://code.sololearn.com/WT514EAUL617/?ref=app
26th Apr 2018, 8:12 PM
Morpheus
Morpheus - avatar
+ 3
I have wrote a code but it doesn't work. https://code.sololearn.com/WzgcsUxIFs46/?ref=app
26th Apr 2018, 8:22 PM
Kris V
+ 1
Hi Kris I can confirm that local storage api works in the desktop browser but not mobile Sololearn app. They even turned off Cookies and Web Cache :-(, which all work in the desktop version of Sololearn. You cant make multiple pages in Sololearn app anyways, which is why I created this example of a Psuedo Multipage app using HTML Articles. https://code.sololearn.com/W7Ptp9xkYbnM/#html Then you only need to use normal JS variables to move the data between sections feel free to use and copy as needed.
27th Apr 2018, 10:21 AM
Mike Choy
Mike Choy - avatar