如何在JavaScript中保存Cookie值时设置路径? [英] How do I set path while saving a cookie value in JavaScript?
问题描述
我在ASP页面上保存一些cookie值。我想设置cookie的根路径,以便cookie将在所有页面上可用。
目前的cookie路径是 / v / abcfile / frontend /
请帮助我。
: document.cookie =name = value; path = /;
$ b 现在,该cookie将可用于域$ b的所有目录$ b设置为。如果网站只是该域中的许多网站之一,那么
最好不要这样做,因为其他人也可以访问
您的Cookie信息。
I am saving some cookie values on an ASP page. I want to set the root path for cookie so that the cookie will be available on all pages.
Currently the cookie path is /v/abcfile/frontend/
Please help me.
simply: document.cookie="name=value;path=/";
There is a negative point to it
Now, the cookie will be available to all directories on the domain it is set from. If the website is just one of many at that domain, it’s best not to do this because everyone else will also have access to your cookie information.
这篇关于如何在JavaScript中保存Cookie值时设置路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!