mshen
01-12-2003, 03:35 PM
I want to use javascript to check if current broswer support cookie or not?do you think it is possible or not?
Thanks a lot.
Thanks a lot.
|
Click to See Complete Forum and Search --> : check broswer setting? mshen 01-12-2003, 03:35 PM I want to use javascript to check if current broswer support cookie or not?do you think it is possible or not? Thanks a lot. pyro 01-12-2003, 03:37 PM Why not just set a cookie and then try to read from it? You could set the cookie to expire in a minute or so, so it won't be hanging around on the users computer... mshen 01-12-2003, 03:40 PM do you mean I only can have to program back end code?Thanks pyro 01-12-2003, 04:13 PM This code should let you know if you have cookies. <html> <head> <script type="text/javascript"> function setcookie() { var cookieDies = new Date(); cookieDies.setTime(cookieDies.getTime() + 30*1000); document.cookie="havecookie=yes;expires=" + cookieDies.toGMTString() } function havecookie() { if (document.cookie != "") { alert ("You have cookies"); } else { alert ("You don't have cookies"); } } </script> </head> <body onload="setcookie();havecookie()"> </body> </html> webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |