Detecting Javascript via ASP

A

Astra

Hi All

I want to print a message on the first page if a client's browser doesn't
have JavaScript enabled. To do this I used the following code:

<%
' create an instance of the Browser Capabilities component
dim BrowserDetect
Set BrowserDetect = Server.CreateObject("MSWC.BrowserType")

IF BrowserDetect.JavaScript = false THEN
Response.Write pJSWarning
END IF

Set BrowserDetect = nothing
%>

This would be great if it actually worked. I've just run FireFox up, which
definitely has Javascript running, and my warning message appears saying
there is no javascript. Whaaahhh!?!?!

Is there a better way of doing this check in ASP?

Thanks

Robbie
 
P

Phill. W

Astra said:
I want to print a message on the first page if a client's browser
doesn't have JavaScript enabled. To do this I used the following code:

There is *nothing* that you can /reliably/ run Server-side (i.e. in an
ASP) that will tell you whether or not any given browser will do
anything useful with JavaScript. You *have* to get the browser to
tell you, one way or the other.

The Browser might be /capable/ of supporting JavaScript, but I
might have disabled it! I know, I'm an awkward blighter. ;-)

Personally, I bounce a page off the client with both "onLoad" code
and a Meta "refresh" tag, each of which redirects to my "YesOrNo"
page, passing a different [QueryString] value. Pop that into a
Session Variable and I know whether to bother sending JavaScript
code to this client.

HTH,
Phill W.
 
A

Aaron Bertrand [SQL Server MVP]

Hear, hear. What kind of w*nker does anything on the web with disabled
javascript?
 
C

Curt_C [MVP]

Aaron said:
Hear, hear. What kind of w*nker does anything on the web with disabled
javascript?
hehehehe you tell em Aaron. :}
WWW with no javascript is like wanting to drive a car with no fuel, sure
it can be done but the results SUCK in abilities.
 
A

Adrienne

Hear, hear. What kind of w*nker does anything on the web with disabled
javascript?

Google, users in some corporate environments, users who are tired of pop-
ups, unders, etc, users who are tired of browser hijacking and spyware
installers on malicious sites.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top