Mit*_*pta 7 session html5 session-storage internet-explorer-10
我使用以下代码来测试HTML 5的会话存储.它在除IE之外的所有浏览器中都能正常工作.安装的IE版本是10.
代码:
<!DOCTYPE html>
<html>
<head>
<script>
function clickCounter()
{
if(typeof(Storage)!=="undefined")
{
if (sessionStorage.clickcount)
{
sessionStorage.clickcount=Number(sessionStorage.clickcount)+1;
}
else
{
sessionStorage.clickcount=1;
}
document.getElementById("result").innerHTML="You have clicked the button " + sessionStorage.clickcount + " time(s) in this session.";
}
else
{
document.getElementById("result").innerHTML="Sorry, your browser does not support web storage...";
}
}
</script>
</head>
<body>
<p><button onclick="clickCounter()" type="button">Click me!</button></p>
<div id="result"></div>
<p>Click the button to see the counter increase.</p>
<p>Close the browser tab (or window), and try again, and the counter is reset.</p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
可能是什么问题呢?
Mit*_*pta 18
我在HTML5的本地存储和会话存储功能中发现的是,这两个功能仅在浏览页面时才能在Internet Explorer中工作HTTP,并且当您尝试在本地文件系统上访问这些功能时,这些功能将无法工作,即您试图直接从文件系统打开示例网页与URL的类型 C:/Users/Mitaksh/Desktop等.
通过任何application server类似的方式部署您的应用程序Tomcat,然后访问它..然后您可以看到本地和会话存储在运行中..