Skip to content

Instantly share code, notes, and snippets.

@mferretti
Created July 12, 2012 10:42
Show Gist options
  • Save mferretti/3097343 to your computer and use it in GitHub Desktop.
Save mferretti/3097343 to your computer and use it in GitHub Desktop.
Test for store.js + IE7 : which chars can be used in the key ?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
<title>store.js+special char + IE7 test</title>
<script src="./json.js"></script>
<script src="./store.js"></script>
<script type="text/javascript">
function testStore(key, value, charCode){
try{
store.set(key,value);
if ( store.get(key)==value ) {
document.write("<p>test code " + charCode + " : success</p>");
} else {
document.write("<p style=\"color:red\">code " + charCode + " : returned a different value</p>");
}
}catch(e){
document.write("<p style=\"color:red\">code " + charCode + " throwed an "+e.message+"</p>");
}
}
</script>
</head>
<body>
<script type="text/javascript">
if(store.enabled){
var maxCode = 128;
var i;
var key = "";
for (i=0;i<maxCode;i++)
{
key = "key" + String.fromCharCode(i);
testStore(key,"test value", i);
}
} else {
document.write("<p style=\"color:red\">store is not enabled</p>");
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment