1
0
mirror of https://github.com/Pathduck/pathduck.github.io.git synced 2025-12-29 11:45:20 -05:00
Files
2025-06-01 11:43:10 +02:00

47 lines
1.6 KiB
HTML
Executable File

<!DOCTYPE html>
<html>
<head>
<title>Test of HTML5 localStorage and sessionStorage persistence</title>
<style>body {color: white; background: darkslategray;} a {color: deepskyblue;}</style>
</head>
<body>
<h2>Test of HTML5 localStorage and sessionStorage persistence</h2>
<p>Enter data in either box and click the button to store it. If you navigate to this page in a new window or tab, or quit and relaunch your browser, localStorage will remain and sessionStorage will disappear.</p>
<p>Reload the page to verify the values are stored. Then click the button to open a popup window.</p>
<p>Popups and new tabs opened from a <code>window.open</code> event should inherit both storage values</p>
<p>
Local storage:<br>
<input type="text" placeholder="nothing currently stored" size="30" id="local" />
<input type="button" onclick="store_it('local', window.localStorage);" value="Store it" />
</p>
<p>
Session storage:<br>
<input type="text" placeholder="nothing currently stored" size="30" id="session" />
<input type="button" onclick="store_it('session', window.sessionStorage);" value="Store it" />
</p>
<p id="local-warning"></p>
<p id="session-warning"></p>
<p>
<button onclick="window.open('index.html', '_blank', 'width=600, height=500'); return false;">Open Popup</button>
<button onclick="window.open('index.html'); return false;">Open New Tab</button>
</p>
<p>
<button onclick="window.open('index.html', 'popup', 'width=600, height=500'); return false;">Open Named Popup</button>
</p>
<script type="text/javascript" src="storage-test.js"></script>
<script>
function openPopup() {
}
</script>
</body>
</html>