HTML5, localStorage

In this example, the page will load first without the text stored by HTML5. On refresh you will see the text: “The text you want to save”, appear in the <div> container.

<!DOCTYPE html>
   <script src=""></script>
   <header>Storing Items using HTML5</header>
   <div id="show">Text Stored: </div>
      if(localStorage.getItem("varContainer")) {
   localStorage.setItem("varContainer", "The text you want to save");

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s