I’m wondering if using the following Javascript code is reliable:
if (!document.cookie) {
alert('Cookies are disabled.');
}
I’ve tested this in IE, Firefox and Chrome and it seems that when you disabled cookies, the document.cookie object becomes unavailable. Does anyone have any experience with this method working/not working?
Many Thanks
Stephen
Additional
I’m well aware that this method requires JavaScript to be enabled on the client. I’m also aware of other server-side/JavaScript solutions. Please can the discussion remain on topic.
The only reliable way to me in this scenario (check if cookies are disabled, you don’t mind about the javascript issues, and need a client-side solution) is to use a set function for a test cookie, then a get function to read it back. If the test cookie can’t be read back, cookies are off.
You can write your own implementation of it reading a great resource from quirksmode, use a jQuery plugin or an out-of-box solution.