I want to test out local storage html 5 feature
found some sample code( see below)
When I tried their online version it works.
I downloaded their code and created the html file.
When I open it locally and hit the refresh button it doesn’t remember the content. Why is this?
sample code:
<html>
<head>
<title>HTML5 contenteditable example</title>
<script>
function storeUserScribble(id) {
var scribble = document.getElementById(‘scribble’).innerHTML;
localStorage.setItem(‘userScribble’,scribble);
}
function getUserScribble() {
if ( localStorage.getItem(‘userScribble’)) {
var scribble = localStorage.getItem(‘userScribble’);
}
else {
var scribble = ‘<font color=blue face=”Geneva, Arial” size=5><i>You can scribble directly on this sticky… and I will also remember your message the next time you visit my blog!</i></font>’;
}
document.getElementById(‘scribble’).innerHTML = scribble;
}
</script>
</head>
<body>
<p>
<center>
<table width=480 height=480 border=0 cellspacing=0 cellpadding=62>
<td background=”
</table>
<script>
getUserScribble();
</script>
<center>
<p>
</body>
</html>