Created
May 12, 2014 07:27
-
-
Save carlosrojaso/d4ab31b87f841c3260be to your computer and use it in GitHub Desktop.
Storage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<div id="result"></div> | |
<script> | |
// Check browser support | |
if (typeof(Storage) != "undefined") | |
{ | |
// Store | |
localStorage.setItem("lastname", "Smith"); | |
// Retrieve | |
document.getElementById("result").innerHTML=localStorage.getItem("lastname"); | |
} | |
else | |
{ | |
document.getElementById("result").innerHTML="Sorry, your browser does not support Web Storage..."; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment