Solved

server-side javascript enabled detection

Posted on 2003-12-01
10
784 Views
Last Modified: 2012-08-14
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!
0
Comment
Question by:Kupi
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 33

Expert Comment

by:hongjun
ID: 9850235
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
0
 
LVL 3

Author Comment

by:Kupi
ID: 9850288
I need the detection to happen before the <html> tag...
0
 
LVL 33

Accepted Solution

by:
hongjun earned 50 total points
ID: 9850320
With help of cookies, you can do so
http://www.4guysfromrolla.com/webtech/082400-1.shtml

hongjun
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 3

Author Comment

by:Kupi
ID: 9850397
What if I can't create hidden fields or execute onload functions because the <html> tag has not yet be generated?
0
 
LVL 4

Assisted Solution

by:c_swanky
c_swanky earned 50 total points
ID: 9851981


<%
Set browserdetect = Server.CreateObject("MSWC.BrowserType")
Response.Write("JavaScript: " & browserdetect.JavaScript)
%>
0
 
LVL 4

Expert Comment

by:c_swanky
ID: 9852040
sorry, scratch that... this will only tell you if the browser is JavaScript compatible, not if the user has it disabled.
0
 
LVL 4

Expert Comment

by:c_swanky
ID: 9852077
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>
0
 
LVL 3

Author Comment

by:Kupi
ID: 9857018
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...
0
 
LVL 8

Expert Comment

by:fozylet
ID: 11961387
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
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question