+ 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?
5 Réponses
+ 14
localStorage.getItem('label')
localStorage.setItem('label', 'value')
+ 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/
+ 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
+ 3
I have wrote a code but it doesn't work.
https://code.sololearn.com/WzgcsUxIFs46/?ref=app
+ 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.