开发者

I don't want a specific path for my cookie using javascript

I am setting a cookie, but I don't want it to just work for one directory. How do I make it to where it's read throughout my whole site? I'm pretty new at JavaScript, thanks guys!

开发者_Python百科
<script>
function setCookie(val) {

   var d = new Date();
   d.setDate(d.getDate() + 300);
   document.cookie = "roster_count" + "=" + escape(val) + "; expires=" + d.toGMTString();

   delete d;
}
</script>


The the path /:

document.cookie = "roster_count" + "=" + escape(val) + "; expires=" + d.toGMTString() + "; path=/";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜