ScottHamper / Cookies

JavaScript Client-Side Cookie Manipulation Library
The Unlicense
1.77k stars 170 forks source link

Cookies.enabled always returns true in IE7/IE8 #19

Closed brianlow closed 10 years ago

brianlow commented 10 years ago
  1. Open IE
  2. Tools -> Options -> Privacy -> Advanced -> Block
  3. http://jsfiddle.net/Z9mXQ/

I think because navigator.cookieEnabled always returns true.

ScottHamper commented 10 years ago

Thanks for this! I noticed some interesting behavior with IE, even in version 11. If you go to Privacy -> Advanced and set to override automatic cookie handling to block first and third party cookies, then refresh the page, navigator.cookieEnabled returns true, but cookies cannot be set. However, if instead of using the advanced options, I simply raise the privacy slider all the way up to block all cookies, then navigator.cookieEnabled returns false.

So I don't really understand what IE is doing there, but I'll just have Cookies.enabled verify that a cookie can actually be set, and remove any check against navigator.cookieEnabled. navigator.cookieEnabled isn't even part of any web standard, so whatever!

brianlow commented 10 years ago

Thanks for the quick fix! What do you think about deleting the test cookie so the function is side-effect free?

ScottHamper commented 10 years ago

Derp - yea, I'll definitely do that.

brianlow commented 10 years ago

Thanks for the library!