cookies.js 440 B

123456789101112131415
  1. // by tauren
  2. // https://github.com/Modernizr/Modernizr/issues/191
  3. Modernizr.addTest('cookies', function () {
  4. // Quick test if browser has cookieEnabled host property
  5. if (navigator.cookieEnabled) return true;
  6. // Create cookie
  7. document.cookie = "cookietest=1";
  8. var ret = document.cookie.indexOf("cookietest=") != -1;
  9. // Delete cookie
  10. document.cookie = "cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT";
  11. return ret;
  12. });