html5 - Add data to localstorage and use it on another page -
is possible can save data local storage on site , use later on page on same site?
for example: have button "add localstorage" in page: http://www.domain.com/exhibitors/view/41873 , when click add data local storage , after on want use on http://wwww.domain.com/favorites/view/
is possible?
yes possible, have set localstorage :
localstorage.username = "user";
now have retrieve , wherever want, like:
alert(localstorage.username);
in case have to somenthing this:
<a href="#" onclick="localstorage.username = 'paul'">add localstorage</a>
then in view somewhere else do:
<script> alert(localstorage.username); </script>
usually there 2 possibilities:
localstorage
= think @ cookie (it persists on browser closing)
sessionstorage
= think @ session (it persists until close browser)
obviously
it's highly suggested not store sensible data in browser, use them routines not storing passwords example, cause, user can edit them browser, , malicious users can too
Comments
Post a Comment