dottodot
dottodot

Reputation: 1619

Detecting Advanced privacy settings in IE using Javascript

At the moment I'm using Modernizr to detect if the client is blocking cookies and provide warnings if it's going to prevent them doing something i.e login or add to cart.

https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cookies.js

However I've found that if you use the Advanced privacy settings to block cookies this is not detected so the user doesn't get any warning and the site will appear to be broken.

I can't seem to find anything that suggests any way around this.

Upvotes: 0

Views: 112

Answers (1)

T.J. Crowder
T.J. Crowder

Reputation: 1074335

The Modernizr test is a purely client-side test. If IE's settings fool that test, it seems like you'll need to set a cookie in your main response, then do an ajax call and see if the cookie went back to the server. If it did, cookies aren't blocked; if it didn't, they are.

This also has the advantage that it's an end-to-end test: It doesn't matter where the cookie was blocked (the browser, a proxy, etc.), it'll tell you whether cookies currently work for that user in that environment with your site.

Upvotes: 2

Related Questions