[thelist] Speaking of detecting: howto detect Javascript on/off?

James Aylard evolt at equilon-mrc.com
Wed Mar 14 18:25:38 CST 2001


> based on the rest of this thread which i've been keeping my eye on you
> to be asking how this can be useful.  well, obviously it wouldn't be of
> use in the first page you encounter, but any subsequent page you serve
> take this value into account when constructing the page to send to the
> browser.  this wouldn't be of much use in the case where you aren't
> maintaining some sort of session state though.  where it would be really
> useful is for determining prior to login whether a user had js enabled or
> not so you could tailor your administrative tools behind the login to
> browser needs.

    That's what I finally concluded, after a bout of confusion. When you
initially described it, for some reason I inferred (obviously incorrectly)
that it was possible to use the pseudo-image to affect the page that
contained it.
    My view now is that both the redirect approach and the pseudo-image
approach have benefits and drawbacks, depending on the intended purpose.
    The pseudo-image would be especially useful on a splash page or some
other kind of entry page which itself does not require javascript. The fact
that it doesn't force a redirect avoids the potential complications of a
redirect loop when the browser Back button is pressed. The fact that, as I
see it anyway, it relies on setting a session variable is a drawback due to
their widely known weaknesses.
    The auto-refresh approach avoids the session problem altogether by using
a querystring, and if the page calls itself -- using ASP, ColdFusion, or
whatever -- it allows that same page to tailor itself appropriately. Or you
could redirect to another page altogether. (It would be nice to do
window.location.replace() for browsers that support it, but testing for this
method throws an error in IE 4 and IE 5.0x, which makes the test unusable --
Microsoft fixed this bug in IE 5.5. Works in every other browser that I know
of, though.)
    Maybe some type of Evolt article would be in order. I'll think about

James Aylard

More information about the thelist mailing list