js 读取cookies

IE浏览器把 cookeis 保存到这个文件夹下(可能每个浏览器存放的位置是不一样的):C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files

如果想读取相应网站下的cookies,可以修改hosts文件 ,用以下脚本即可读取

 

<script type="text/javascript" > 
var thisCookie;
if (document.cookie == "")
{
   document.write("There are no cookies here");
}
else
{
    thisCookie = document.cookie.split(";");   //每个Cookie用“;”分隔
    for (i=0; i<thisCookie.length; i++)
    {
        document.write("Cookie name is: ["+ thisCookie[i].split("=")[0]);
        
        document.write("] , the length is: ["+ thisCookie[i].split("=").length);
        
        document.write("] , and the value is: ["+thisCookie[i].split("=")[1]+"]<BR><BR>");
    }
}
</script>

posted on 2016-05-19 17:58  改变从今天开始  阅读(389)  评论(0)    收藏  举报

导航