[thelist] Speaking of detecting: howto detect Javascript on/off?
jeff
jeff at members.evolt.org
Wed Mar 14 12:37:56 CST 2001
james,
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: James Aylard
:
: In my example page, I set a value in
: the querystring (js=true or js=false)
: which I grabbed in ASP and then took
: action accordingly. You could also
: redirect to two different pages. And
: if you want to be thorough, you can
: add a link for those browsers that
: don't even support meta redirects.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
all of this redirection-detection got me thinking. what if there were a way
to detect without a redirect? how would one do that? what i'd do is swap
an image (well, not really an image, but i think you'll understand where i'm
going with this) and pass it on the server that way. something like this:
<img
src="detect_js.cfm?js=0"
height="1"
width="1"
border="0"
onLoad="if(document.images)
this.src = 'detect_js.cfm?js=1'">
the file on the server simply checks the value of the url variable "js" and
sets the session variable or whatever to that value. obviously it's going
to receive a value of 0 first and then possibly a value of 1 if the user has
javascript (and is using a js1.1+ browser) turned on. then it just sets the
content type of the content it returns and sends a 1x1 pixel image down the
pipe to the browser (this is crucial if you want the onLoad event handler to
fire in the first place).
good luck,
.jeff
name://jeff.howden
game://web.development
http://www.evolt.org/
mailto:jeff at members.evolt.org
More information about the thelist
mailing list