How to pass parameters (values) from one web page to another webpage or store and retrieve data from local storage. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

How to pass parameters (values) from one web page to another webpage or store and retrieve data from local storage.

Please, Tell me how to store data by only using frontend technologies like HTML/JS or Java.

8th Dec 2019, 2:31 AM
Shashank Reddy Voorelli
Shashank Reddy Voorelli - avatar
1 Answer
+ 1
To store data use: localStorage.setItem(key, value) To read a key use: localStorage.getItem(key) And if you want to pass data from webside you could use params in the url like this: http://totally.real/url?key1=value1&key2=value2 To get these params on the second page you could use window.location.search.substring(1), whereas substring(1) removes the question mark at the beginning.
11th Dec 2019, 7:10 PM
Jakob Meier
Jakob Meier - avatar