Related Tags:
JQuery JQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. Learn More, JavaScript Javascript is an object-oriented computer programming language commonly used to create interactive effects within web browsers. Learn More, HTML Hypertext Markup Language, a standardized system for tagging text files to achieve font, colour, graphic, and hyperlink effects on World Wide Web pages. Learn More, Cookie(Browser's Cookie) A small text file (up to 4KB) created by a website that is stored in the user's computer either temporarily for that session only or permanently on the hard disk (persistent cookie). Cookies provide a way for the website to recognize you and keep track of your preferences. Learn More,

cookie value breaking at comma in some browsers

Description:I am storing some dynamic value in cookies which may or may not contains comma and I noticed that in some mobile browsers it is breaks the value and create a new cookie instead

Posted by: | Posted on: Jan 02, 2019

1 answers

Replies

3

Actually some characters like comma and semicolon should not be used inside the cookie value which used as separators for cookies.
And in your case a simple solution could be to replace "," with "%2C" and replace ";" with "%3B" before setting it as cookie value and perform vise versa when retrieving the value to get actual string.
for example:

value = value.replace(",", "%2C").replace(";", "%3B");

Replied by: | Replied on: Jan 02, 2019



Reply
×

Code block Hyperlink bold Quotes block Upload Images

Preview