<html>
<head>
<script type="text/javascript">function checkCookie()
{
var exdate=new Date()
exdate.setDate(exdate.getDate()+3)
document.cookie="id=1234"+";expires=" + exdate.toGMTString()
str=document.cookie
if(str!=null&&str!=""){
alert(document.cookie)
}else{
alert("mb")
}
}
</script>
</head>
<body onLoad="checkCookie()">
</body>
</html>
为什么cookie是空的呢
<head>
<script type="text/javascript">function checkCookie()
{
var exdate=new Date()
exdate.setDate(exdate.getDate()+3)
document.cookie="id=1234"+";expires=" + exdate.toGMTString()
str=document.cookie
if(str!=null&&str!=""){
alert(document.cookie)
}else{
alert("mb")
}
}
</script>
</head>
<body onLoad="checkCookie()">
</body>
</html>
为什么cookie是空的呢
Chrome不支持本地Cookie
你可以
1:尝试将其上传至服务器上
2:
2.1:用记事本打开C:\WINDOWS\system32\drivers\etc\hosts文件 并在其内新增一行
127.0.0.1 3w.abc.com
2.2:在IIS中给你的本地站点加上3w.abc.com的主机头值
2.3:通过访问:http://3w.abc.com去访问你的网站Lz尝试一下吧。第2种,一般本地开发时模拟运行环境就可以那样做了。好处不少