Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Server Side Javascript Detection 2

Status
Not open for further replies.

btgroup

MIS
Jan 21, 2003
64
US
Hello,

I've seen numerous articles explaining how to use the browscap.ini file to detect if javascript is enabled, but seem to be missing something. When I disable javascript by going into Internet Options --> Security settings in IE6 and disable my three Scripting options, my script still returns True for the javascript property.

Can someone please fill me in on what I am missing? I updated my browscap.ini file as well.

Thanks in advance.
 
as far as i understand, just because you disable them doesn't mean it's off, it's like leaving the light on and just putting something in the way so you cant see it, try turning off your javajit in the advanced tab

or perhaps your script is detecting server side status?
 
The browscap file can't tell you if javascript is on or off, it tells you if it is Available. That file basically lists a whoe slew of possible header combinations which ar then resolved into a browser name, OS, and list of common features that combination supports.
There is no way to truly test for javascript being on or off without going to the client to see, but one possible solution is a component like BrowserHawk (CyScape ?) that checks for you without you ever seing it go to the client.

About the easiest way you could check would be to have two pages, First One:
Code:
<html>
<head>
<!-- Put a 2 second Meta refresh here in case javascript is off -->
</head>
<body onLoad="document.getElementsByName('js')[0].value='on';document.getElementsByName('frmJs')[0].submit();">
<form method="POST" action="NextPage.asp" name="frmJs">
<input type="hidden" name="js" value="">
</form>
</body>
</html>
Then on the next page is Request.Form("js") <> "" Then javascript is on, otherwise the meta refresh had to load the new page so javascript wasn't on or I had an error in my javascript I just posted :p

-T


01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
Hmmm...that's what I was afraid of. I already have a similar script that checks as soon as a user logs into my site, but I was hoping to check if they turn off javascript once they are in the site.

Looks like BrowserHawk is the only option. It is kind of expensive so I was hoping to avoid it. Anyone know of other similar components that are cheaper than BrowserHawk?

Thanks for all your help Tarwn and DreXor.
 
You could embed the code I had above in a hidden iframe, that way you would be able to do the detection on the first page they hit, there wouldn't be a visible redirect, etc. I think thats how BrowserHawk probably works, except they check for a lot more stuff than just javascript.

-T

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top