-
Website
http://www.dennmart.com -
Original page
http://www.dennmart.com/2008/09/30/quick-and-dirty-browser-cookie-testing/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
Cheap Textbooks
1 comment · 1 points
-
Dan Gebhardt
1 comment · 1 points
-
kychan
1 comment · 1 points
-
joegrossberg
1 comment · 2 points
-
topfunky
2 comments · 3 points
-
-
Popular Threads
That said, I like your solution even more, since while it does run on each page load, the impact should be negligible, and it doesn't require a page redirect at all. Nice work. :)
-Eric
I've modified your solution to also test for this case. In order to do this, I set the test cookie to a dynamic value, such as the current time. I then check whether the cookie has been set to the dynamic cookie value to ensure that "private browsing" has not been enabled.
In order for this to work, you unfortunately can't delete the cookie after the test. Otherwise, the test won't recognize when the user had a previous session created outside of private browsing mode that they are now trying to change in private browsing mode.
NOTE: I tried to post this comment earlier with a bit of javascript source in my comments, but DISQUS wasn't happy so I trimmed my code out.