<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>a.html</title>
<script type="text/javascript">
window.onload = function ()
{
if (!!window.localStorage)
{
if (!window.localStorage.access)
{
window.localStorage.access = 1;
}
else
{
window.localStorage.access++;
}
document.getElementsByTagName('div')[0].innerText = window.localStorage.access;
}
else
{
alert ('This browser does NOT support localStorage');
}
}
</script>
</head>
<body>
you have access the page <div></div> times.
</body>
</html>
追问if (!!window.localStorage)
if (!window.localStorage.access)
追答what happend?
追问if (!!window.localStorage)
if (!window.localStorage.access)
什么意思?
追答oh, it means check the localStorage is defined or not
追问请说中文
用IE浏览器打开不行,显示This browser does NOT support localStorage
追答baby, take this. it will be fine on IE