Safari 4 Beta on Windows (build 528.17) has a bug. If expires is in value assigned to document.cookie, cookie is not changed. So, below cookie enable detection doesn't work anymore.
var dt = new Date();
dt.setSeconds(dt.getSeconds() + 2);
document.cookie = "cookietest=1; expires=" + dt.toGMTString();
var cookiesEnabled = document.cookie.indexOf("cookietest=") != -1;
If I just remove the expires, it works. However, it will leave a dummy cookie "cookietest=1" in the whole session.
I tried to operate in document.cookie directly to remove the cookie, but it seems there is no way to do that. The only way to "remove" a cookie is to set it expire.
Is there any workaround for this?
UPDATE: There is a bug in Safari 4 Beta for windows. if the expires is no more than 1 hour (3600 seconds) since now, assigning document.cookie would fails.
We can remove the cookie after detection.
var dt = new Date();
dt.setSeconds(dt.getSeconds() + 2);
document.cookie = "cookietest=1";
var cookiesEnabled = document.cookie.indexOf("cookietest=") != -1;
document.cookie = "cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT";