Simplest way to check if cookies are enabled or disabled - JavaScript
How can I make a simple check if cookies are enabled or disabled, using JavaScript ?
Hi,
To make a simple check if cookies are enabled or disabled in visitor's web browser, you can use the following solution:
function checkCookies(){
document.cookie='c=1';
var v = document.cookie.indexOf("c=")!=-1;
document.cookie = 'c=1; expires=Thu, 01-Jan-1970 00:00:01 GMT';
if(v===true){ alert('Cookies are enabled'); }
else{ alert('Cookies are disabled'); }
}
1 answer