Skip to content

Instantly share code, notes, and snippets.

@steveosoule
Created May 30, 2013 18:23
JavaScript Check if Cookies are Enabled
function are_cookies_enabled(){
var cookieEnabled = (navigator.cookieEnabled) ? true : false;
if (typeof navigator.cookieEnabled == "undefined" && !cookieEnabled){
document.cookie="testcookie";
cookieEnabled = (document.cookie.indexOf("testcookie") != -1) ? true : false;
}
return cookieEnabled;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment