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=/";
精彩评论