开发者

How do I check if the browser supports cookies, in javascript? [duplicate]

This question alread开发者_C百科y has answers here: How to show a message only if cookies are disabled in browser? [duplicate] (4 answers) Check if the client accepts cookie in javascript? (3 answers) Closed 5 years ago.

Especially for the iPhone


This works in IE, Chrome and Safari (which should be the same as iPhone):

if (navigator.cookieEnabled)
   alert("ON");
else
   alert("OFF");

EDIT: Since nvl decided to take my answer and not check into it I thought I should. Tested it on all the browsers I could find and seems to work just fine.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜