share JS variables between pages using localStorage - Javascript jQuery

Javascript examples for jQuery:Variable

Description

share JS variables between pages using localStorage

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script> 
   </head> 
   <body> 
      <p id="nome"></p> 
      <script>
$(document).ready(function(){
    document.getElementById("nome").innerHTML = localStorage.getItem("key");
});//from w ww .  ja  va2s.  c o m

      </script>  
   </body>
</html>

Related Tutorials