Skip to content

Instantly share code, notes, and snippets.

@oleksiilevzhynskyi
Forked from aratak/jquery.cookieenabled.js
Created December 14, 2011 09:47
Show Gist options
  • Save oleksiilevzhynskyi/1475916 to your computer and use it in GitHub Desktop.
Save oleksiilevzhynskyi/1475916 to your computer and use it in GitHub Desktop.
is cookie enabled?
(function($) {
$.cookieEnabled = function () {
var key = 'testCookieEnabled';
var value = '1';
$.cookie(key, value, { path: '/' });
return $.cookie(key) == value;
};
$(document).ready(function(){
if( !$.cookieEnabled() ) {
window.location = "/cookiesdisabled.html";
}
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment