How to check cookies are enable or disable in borwser
-
Hi all, If the client borwser is cookies disable then i want to show a message to client plz enable ur cookies....... for this i am writing this code but it is not working <script language="javascript" type="text/javascript"> function detect() { if(navigator.cookieEnabled) { alert('Your browser has cookies enabled.'); } else { alert('Your browser has cookies disabled.'); } } </script></head> <body onload="detect();"></body> Thanks a lot........
-
Hi all, If the client borwser is cookies disable then i want to show a message to client plz enable ur cookies....... for this i am writing this code but it is not working <script language="javascript" type="text/javascript"> function detect() { if(navigator.cookieEnabled) { alert('Your browser has cookies enabled.'); } else { alert('Your browser has cookies disabled.'); } } </script></head> <body onload="detect();"></body> Thanks a lot........
Just store a cookie and try to retrieve it using javascript. If proper value is retrieved, you will find cookie is enabled. ;)
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript -
Just store a cookie and try to retrieve it using javascript. If proper value is retrieved, you will find cookie is enabled. ;)
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using JavascriptThnks for Replying ........ I am using IE and also block all cookies but allways answer is ........"cookies found" by fallowing code if (!IsPostBack) { Response.Cookies["test"].Value = "Samar"; Response.Cookies["test"].Expires = DateTime.Now.AddYears(30); if (Request.Cookies["test"] == null) Response .Write ("No cookie found"); else Response .Write ("cookies found"); } if I used gmail then message is comming that plz enable ur cookies ? while according previois code it means cookis is creaing ? then what is exat answer cookies is enable or disable ?
-
Thnks for Replying ........ I am using IE and also block all cookies but allways answer is ........"cookies found" by fallowing code if (!IsPostBack) { Response.Cookies["test"].Value = "Samar"; Response.Cookies["test"].Expires = DateTime.Now.AddYears(30); if (Request.Cookies["test"] == null) Response .Write ("No cookie found"); else Response .Write ("cookies found"); } if I used gmail then message is comming that plz enable ur cookies ? while according previois code it means cookis is creaing ? then what is exat answer cookies is enable or disable ?
Did you try redirecting the page, and find cookies from another page ? Say in your page1 you place : Response.Cookies["test"] = "Samar"; In page2 you try to retrieve it using : if(Request.Cookies["test"] == null) Response.Write("No cookie found"); During the login process, Gmail actually redirects to more than one page before going to actual Gmail Console. So it is easier to them to understand if cookie is actually enabled or not. I think if you do like this in your login process, you can easily detect this. :)
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Windows7 API Code Pack
Simplify Code Using NDepend
Basics of Bing Search API using .NET -
Did you try redirecting the page, and find cookies from another page ? Say in your page1 you place : Response.Cookies["test"] = "Samar"; In page2 you try to retrieve it using : if(Request.Cookies["test"] == null) Response.Write("No cookie found"); During the login process, Gmail actually redirects to more than one page before going to actual Gmail Console. So it is easier to them to understand if cookie is actually enabled or not. I think if you do like this in your login process, you can easily detect this. :)
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Windows7 API Code Pack
Simplify Code Using NDepend
Basics of Bing Search API using .NETYes ..........Dear I have done according to you in first page button clic event I M writng this ..... Response.Cookies["test"].Value = "Samar"; Response.Redirect("Default2.aspx"); and second page form load event if (Request.Cookies["test"] == null) Response.Write("No cookie found"); else Response.Write("cookie found"); I have disabled the cookie but it is still showing "Cookies found" Note-- I M using IE.
-
Yes ..........Dear I have done according to you in first page button clic event I M writng this ..... Response.Cookies["test"].Value = "Samar"; Response.Redirect("Default2.aspx"); and second page form load event if (Request.Cookies["test"] == null) Response.Write("No cookie found"); else Response.Write("cookie found"); I have disabled the cookie but it is still showing "Cookies found" Note-- I M using IE.
I think this means cookie is not disabled properly in your browser. If the cookie could be read, then browser didnt prevent it to store cookie properly. Also try in other browser and try publishing the application in IIS. :doh:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Windows7 API Code Pack
Simplify Code Using NDepend
Basics of Bing Search API using .NET -
I think this means cookie is not disabled properly in your browser. If the cookie could be read, then browser didnt prevent it to store cookie properly. Also try in other browser and try publishing the application in IIS. :doh:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Windows7 API Code Pack
Simplify Code Using NDepend
Basics of Bing Search API using .NETYes it is Working in Mozilla but not in IE6 How can we check it IE6.........Thnks.......
-
Yes it is Working in Mozilla but not in IE6 How can we check it IE6.........Thnks.......
try this one Request.Browser.Cookies
-
try this one Request.Browser.Cookies
I thing it is for ur borwser supports cookies or not but not for cookies enable or disable
-
I thing it is for ur borwser supports cookies or not but not for cookies enable or disable
I dont know.. But if you can still access the data with Cookies disabled, I think this would be the problem of security in the browser itself which allows the server to read cookies, even if it is disabled. I think it is always better not to rely on data in Cookies. I wonder how the client browser behaves and even clients can delete cookies any time. ;)
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Windows7 API Code Pack
Simplify Code Using NDepend
Basics of Bing Search API using .NET