Request: include default script surrogate for cookies
Posted: Wed Jul 14, 2010 10:16 pm
Disclaimer: I realize this isn't a problem induced by NoScript in any way, but NoScript has become rather the one-stop-shop for fixing bogus Firefox / site / add-on behaviour.
I'm playing with a very small script surrogate that solves a problem that's been driving me up the wall since forever: sites that believe testing navigator.cookieEnabled is still a valid way to find whether a browser accepts cookies. An example of two (not a typo) large-ish sites that do this:
Unfortunately, from Fox 3.6.x on down (I haven't tested Fox 4.x builds), the global cookie preferences still determine what navigator.cookieEnabled returns: site exceptions are not taken into account. Ever. The vast majority of websites actually work quite well with extensions such as Cookie Monster and CS Lite, correctly detect whether cookies are enabled (probably by attempting to set a cookie, then testing whether an error occurred, which seems like the only sane way to do it...), correctly display errors if cookies are not allowed for that site, and so forth.
Sites coded up by dunces, as in the two examples, simply test the twelve-year-old flag and refuse logins, draw in-browser "pop-ups" to let you know you've got cookies disabled (even if you're logged in and navigating just fine!) and otherwise break. With the above surrogate, these two sites (at least) work the way you would expect them to.
If the example code is sub-optimal for some reason, it's because I know nearly nothing about JavaScript.
Giorgio: If you happen across my old post requesting help with this problem, throwing a JS exception is equally as bad as Fox' broken cookieEnabled behavior, at least insofar as sites testing this value continue to be broken.
I'm playing with a very small script surrogate that solves a problem that's been driving me up the wall since forever: sites that believe testing navigator.cookieEnabled is still a valid way to find whether a browser accepts cookies. An example of two (not a typo) large-ish sites that do this:
Code: Select all
noscript.surrogate.cookie.replacement="navigator.__defineGetter__("cookieEnabled", function() { return true })"
noscript.surrogate.cookie.sources="@*.monster.com @*.newjobs.com @*.nintendo.com"
Sites coded up by dunces, as in the two examples, simply test the twelve-year-old flag and refuse logins, draw in-browser "pop-ups" to let you know you've got cookies disabled (even if you're logged in and navigating just fine!) and otherwise break. With the above surrogate, these two sites (at least) work the way you would expect them to.
If the example code is sub-optimal for some reason, it's because I know nearly nothing about JavaScript.

Giorgio: If you happen across my old post requesting help with this problem, throwing a JS exception is equally as bad as Fox' broken cookieEnabled behavior, at least insofar as sites testing this value continue to be broken.