Link to home
Start Free TrialLog in
Avatar of Kupi
Kupi

asked on

server-side javascript enabled detection

Is there a server-side way to detect if the client browser has javascript enabled??

I found an external component that does it, but it's not free...

I would like to detect JS status without external DLLs or components, just pure ASP: is this possible?

Thanks!
Avatar of hongjun
hongjun
Flag of Singapore image

courtesy of AspGuru

detection.html
=========
<html>
<head>
<meta http-equiv="refresh" content="1; URL=thepage.asp?script=no">
<script language="Javascript">
 window.location.href='thepage.asp?script=yes';
</script>
</head>
<body></body>
</html>


thepage.asp will have a querystring "script". yes means javascript enabled else not enabled.


hongjun
Avatar of Kupi
Kupi

ASKER

I need the detection to happen before the <html> tag...
ASKER CERTIFIED SOLUTION
Avatar of hongjun
hongjun
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Kupi

ASKER

What if I can't create hidden fields or execute onload functions because the <html> tag has not yet be generated?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
sorry, scratch that... this will only tell you if the browser is JavaScript compatible, not if the user has it disabled.
How about using this?

<noscript>
<% Response.Write("You must have JavaScript enabled to use this form.") %>
</noscript>


 If you need to set a flag, swap out the "Response.Write" with something like this
<noscript>
<% session("bJavaScript") = FALSE %>
</noscript>

- or(redirect them to a non-javascript portion of the site) -

<noscript>
<% response.redirect=("no-javascript.asp") %>
</noscript>
Avatar of Kupi

ASKER

In this way I can prevent users to log in if js is disabled... but what happens if they disable js status after logging in, while they're inside the application?

I should put a js check before every single piece of code...
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
    Accept: hongjun {http:#9850320} & c_swanky {http:#9851981}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

fozylet
EE Cleanup Volunteer