+ 5

How can I have the Javascript input data into sessionStorage?

Heeeeeelllllllppppppp.....

18th Jan 2017, 9:24 PM
Theprogrammers
Theprogrammers - avatar
4 Réponses
+ 2
Well, why use sessionStorage, so? The first link I've previously posted said: Ses­sion­Stor­age - Per­sists a stor­age area for the dura­tion of the page ses­sion. - Use it when you need to store some data tem­porar­ily. A page ses­sion imple­men­ta­tion might be dif­fer­ent based on browser ven­dor and its version. - Data is available as long as the browser is open, includ­ing page reloads and restoresIt gets deleted the time when the tab/window who cre­ated the ses­sion is closed Local­Stor­age - Per­sists the data until the user explic­itly deletes the data. - Use it when you need to store some data for the long term. - Data is available even after the browser is closed and reopened LocalStorage maybe? As you want display the location by an alert, I guess you would like to store the value for acceding to it in another session/page ( sessions in this context have not same meaning as sessions in Php ^^ )... Anyway, always from the first link: The fol­low­ing exam­ple shows the native get­ter and set­ter meth­ods for local­Stor­age. Sim­i­lar meth­ods do exist for ses­sion­Stor­age as well: // setterlocal Storage.setItem("employeeName", "Ryan"); localStorage.setItem("employeeId", 121456789); // getter var name = localStorage.getItem("employeeName"); // Ryan var id = localStorage.getItem("employeeId"); // 121456789 Do you also need help for getting location? :P
20th Jan 2017, 4:48 PM
visph
visph - avatar
+ 4
what i want to do is have the js find the coderunner's location, input it into sesionStorage, then tell the code runner their location in the form of an alert
20th Jan 2017, 4:27 PM
Theprogrammers
Theprogrammers - avatar
+ 2
That's just web pages with essentially textual informations ^^ If you want more precise help, on a particular topic, be less vagueless, show/explicit your code context... We cannot guess enough to much more good targeting a right answer.
19th Jan 2017, 11:04 PM
visph
visph - avatar