Created
April 10, 2015 01:08
-
-
Save hilotech/3fe3c41c74600dafc435 to your computer and use it in GitHub Desktop.
localStorage test
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> | |
<title>localStorage test</title> | |
<body> | |
<h1>localStorage test</h1> | |
<script> | |
if ( ! window.console ) { | |
console = { | |
log : function( s ) { | |
alert( s ); | |
} | |
} | |
} | |
var isEnabledLocalStorage = false; | |
try { | |
if ( !window.localStorage ) { | |
console.log( 'window.localStorage property does not exist.' ); | |
} else { | |
console.log( 'window.localStorage propety exists.' ); | |
isEnabledLocalStorage = true; | |
if ( window.localStorage === null ) { | |
console.log( 'window.localStorage is null.' ); | |
isEnabledLocalStorage = false; | |
} | |
} | |
} catch (e) { | |
console.log( 'window.localStorage propety causes exception.' ); | |
} | |
console.log( isEnabledLocalStorage ); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment