<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script>
var mem = window['localStorage'] || null;
if(mem) mem['k'] = 'test';
function g() {
if(mem) alert(mem['k'])
}
</script>
</head>
<body>
<button onclick="g()">GO</button>
</body>
</html>