Created
April 17, 2012 19:06
-
-
Save treasonx/2408334 to your computer and use it in GitHub Desktop.
Firefox localStorage Issues
This file contains 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> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | |
<title>LocalStoreBug</title> | |
</head> | |
<body> | |
<script type="text/javascript" charset="utf-8"> | |
var v = localStorage.getItem('baz'); | |
if(v) { | |
console.log(v); | |
//Uncomment the following reading of localStorage and everything will work as expected! | |
//console.log(localStorage); | |
localStorage.removeItem('baz'); | |
console.log(localStorage); | |
} else { | |
localStorage.setItem('foo', 'thing'); | |
localStorage.setItem('bar', JSON.stringify({obj:'thing'})); | |
localStorage.setItem('baz', '1'); | |
console.log('Baz Not Found Refresh'); | |
console.log(localStorage); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment