why cookies are always disabled in IE 10

i am using

 navigator.cookieEnabled

in JavaScript to determine whether cookies enabled or not on client. its working fine on all browsers except IE. Please help am i using wrong method for identifying about cookies is there something wrong with IE 10

Answers


The most reliable way I can think of to check whether cookies are enabled is to set a cookie in your response from the server in the first place, and check that it's set on the client via document.cookie. According to this answer to another question, there's no point in checking cookieEnabled, it doesn't provide correct information.

For instance, if your server includes this header in the response serving the page:

Set-Cookie: cc=1; Max-Age=3600

...then your JavaScript code can check like this:

if (/\bcc=/.test(document.cookie)) {
    // They appear to be enabled
} else {
    // Not so much
}

Need Your Help

Java JAI access error in Eclipse

eclipse image-processing java jai

I'm having this error while importing JAI(Java Advanced Imaging) library.

Google Maps API : Display location with Marker and Description

javascript html5 google-maps

I am working on my own website, and everything is starting to come together except for the buttons. Currently, when the location button is clicked, a JS alert message appears. This is unacceptable!...