简体   繁体   English

读取 cookie,更新 cookie 的新名称/值,然后再次读取 cookie

[英]Reading a cookie, updating a new name/value to the cookie and then read the cookie again

I need to read the existing Javascript cookie, add a name and value pair to that cookie.我需要阅读现有的 Javascript cookie,向该 cookie 添加名称和值对。 Then read the cookie again checking for whether the added name value pair is existing.然后再次读取 cookie,检查添加的名称值对是否存在。 if on exists i need to do the page redirect.如果存在,我需要进行页面重定向。

Here's how one would set a cookie and then test its value using the YUI framework.下面是如何设置一个 cookie,然后使用 YUI 框架测试它的值。 Every framework has cookie functions which make it easier: http://jsfiddle.net/jfriend00/RahHQ/ .每个框架都有 cookie 功能,使其更容易: http://jsfiddle.net/jfriend00/RahHQ/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM