Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

40. 如何删除 cookie #57

Open
webVueBlog opened this issue Jun 9, 2022 · 0 comments
Open

40. 如何删除 cookie #57

webVueBlog opened this issue Jun 9, 2022 · 0 comments

Comments

@webVueBlog
Copy link
Owner

您可以通过将到期日期设置为已通过日期来删除 cookie。在这种情况下,您不需要指定 cookie 值。例如,您可以删除当前页面中的用户名 cookie,如下所示。

document.cookie =
  "username=; expires=Fri, 07 Jun 2019 00:00:00 UTC; path=/;";

注意:您应该定义 cookie 路径选项以确保删除正确的 cookie。除非您指定路径参数,否则某些浏览器不允许删除 cookie。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant