The most simplest way of detecting 'Cookies Enabled' with a User's Web Browser
The cookies are the most tastiest and most desired snacks for everyone. Even on the information highway, cookies are the most used to fill the gap of stateless HTTP. However, due to privacy and security reasons, many users may still opt for disabling the cookies. When we have our application constrained in such a way that cookie support is mandatory, we need to ensure that we seamlessly detect support of cookie in the web browser and alert user accordingly.
Fortunately, with JavaScript, a simple function call is enough to detect and tell whether cookie support is enabled or not.
<Script Language="JavaScript">
if (navigator.cookieEnabled)
alert ("Your web browser has cookies enabled");
else
alert ("Oops. Your web browser seems to be refusing cookies");
</Script>
It is that simple as saying 1,2, 3 right?
The cookies are the most tastiest and most desired snacks for everyone. Even on the information highway, cookies are the most used to fill the gap of stateless HTTP. However, due to privacy and security reasons, many users may still opt for disabling the cookies. When we have our application constrained in such a way that cookie support is mandatory, we need to ensure that we seamlessly detect support of cookie in the web browser and alert user accordingly.
Fortunately, with JavaScript, a simple function call is enough to detect and tell whether cookie support is enabled or not.
<Script Language="JavaScript">
if (navigator.cookieEnabled)
alert ("Your web browser has cookies enabled");
else
alert ("Oops. Your web browser seems to be refusing cookies");
</Script>
It is that simple as saying 1,2, 3 right?
1 comment:
Works, as long as they don't have Javascript disabled too. :)
Thanks for the tip.
Post a Comment