LocalStorage | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

LocalStorage

I wanna make an application with html and js. why LocalStorage.setItem('number' , 7) and then LocalStorage.getItem('number') in another html page not working in some smartphones? and what are alternative ways to do this?

8th Mar 2019, 7:15 PM
Aniseh Fasihi Harandi
Aniseh Fasihi Harandi - avatar
4 Answers
+ 4
Try it with js cookies
8th Mar 2019, 8:18 PM
RISHABH MISHRA
RISHABH MISHRA - avatar
+ 3
I think so . I can't exactly say about the code as I also not know much about it
8th Mar 2019, 8:41 PM
RISHABH MISHRA
RISHABH MISHRA - avatar
+ 1
Is the following correct for setting the cookie? document.cookie = " number=7; expires= Thu, 20 Dec 2019 20:00:00 UTC; path=/"; my problem is that I don't know how to get this cookie? Please help me out ♡
8th Mar 2019, 8:34 PM
Aniseh Fasihi Harandi
Aniseh Fasihi Harandi - avatar
+ 1
Actually I want to use this number in a function in another html page inside script tags.
9th Mar 2019, 7:19 AM
Aniseh Fasihi Harandi
Aniseh Fasihi Harandi - avatar