File: examples/storage1.html

Recommend this page to a friend!
  Classes of Thomas Björk  >  jQuery Load Favicon  >  examples/storage1.html  >  Download  
File: examples/storage1.html
Role: Example script
Content type: text/plain
Description: Example for webstorage
Class: jQuery Load Favicon
jQuery plugin to load an image as page favicon
Author: By
Last change:
Date: 6 years ago
Size: 2,243 bytes


Class file image Download
<!DOCTYPE html>
    <title>Storage - Demo 1</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- load jQuery -->
    <script src=""></script>
    <!-- load utils -->
    <script src="../jquery.utils-min.js"></script>
      jQuery(document).ready(function() {
        var value;
        if('testValue1')) {
          value = JSON.stringify('testValue1'));
        } else {
          value = '- No value set....yet! -';
      function SetValue() {
        var value;'testValue1', jQuery('#demoStorage').val());
        if('testValue1')) {
          value = JSON.stringify('testValue1'));
        } else {
          value = '- No value set....yet! -';
        return false;
    <h1>Storage - Demo 1</h1>
      The last value was: <span id="storedValue"></span><br />
      <br />
      <em style="font-size: 80%;">The storage component will primarily check for and use localStorage.
      If localStorage isn't available then it tries to use sessionStorage.
      If sessionStorage fails as well then a simple key-value store is
      setup within the module.<br />
      The localStorage will preserve data until removed.<br />
      The sessionStorage will preserve data until the current session ends<br />
      The local key-value store will keep the data until the page is reloaded</em>
    <br />
    <br />
    <br />
    <hr />
    <form action="#">
      <input type="text" name="demoStorage" id="demoStorage" value="" />
      <button onclick="return SetValue();">Set value</button>
      <li><a href="./index.html" title="Index">Index</a></li>
      <li><a href="./storage1.html" title="Storage 1">Storage 1</a></li>