Solved

server-side javascript enabled detection

Posted on 2003-12-01
10
781 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Syntax Help on SP 4 56
Automatically log-in a new user through code 1 55
Help with stored procedure 30 59
Generate report pulling data (links) from three tables 31 57
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…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

929 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now