开发者

javascript coockie

i need to know how javascript pass through semicolon in coockies. when I give file name with semicolon(eg ;.txt) along with some other value like folder id, document type, and size and try to store all these in cooockies using document.coockie in javascript.

since in javascrip开发者_开发百科t coockiename and value separated using semicolon coockie store values where it found semicolon.If filename contain semicolon it doesnt store it

How can i do it in javascript. and read the value...


I would recommend encoding the value you are putting into the cookie so that the value you are storing can contain semi-colons.

You may want to look at encodeURIComponent and decodeURIComponent.

An example

window.encodeURIComponent(';'); // results in %3B


You need to escape the string you want to store in the cookie

eg: escape('a;') will give "a%3B"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜