473,403 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

discover javascript capabilities from server side

Is there any way via server side code to determine if the browser supports
javascript?
Jun 14 '06 #1
3 1112
> Is there any way via server side code to determine if the browser supports
javascript?


You can tell if the browser supports JS using
Page.Request.Browser.JavaScript. If you want to see if it's actually
*enabled*, it is a little harder; you could check if it's supported and
if so send a page containing a Javascript to redirect to a
Javascript-capable version of your page, which clearly would then only
be reached if script were actually enabled.

An example : http://www.15seconds.com/issue/030303.htm

-- PH

Jun 14 '06 #2
Genius! Thanks.

"Paul Henderson" <pa***********@pittville.demon.co.uk> wrote in message
news:11**********************@r2g2000cwb.googlegro ups.com...
Is there any way via server side code to determine if the browser
supports
javascript?


You can tell if the browser supports JS using
Page.Request.Browser.JavaScript. If you want to see if it's actually
*enabled*, it is a little harder; you could check if it's supported and
if so send a page containing a Javascript to redirect to a
Javascript-capable version of your page, which clearly would then only
be reached if script were actually enabled.

An example : http://www.15seconds.com/issue/030303.htm

-- PH

Jun 14 '06 #3
Jeremy Chapman wrote:
Is there any way via server side code to determine if the browser supports
javascript?


It's often considered more elegant to determine JavaScript capabilities
on the client and to degrade gracefully if it doesn't.

For example:

<a href="nojs.html" onclick="doSomething();return false">Go</a>

This way, the function is executed if JS is enabled. return false
prevents the HREF to be displayed. If JS is off, the HREF is executed
and nojs.html is displayed, which is a page explaining why the user
experience would be so much better with JS.

Also, if JS is on, you can use object detection to see if only certain
functions are enabled:

if ( document.getElementById )
{
document.getElementById( "..." ).value = "...";
}
else
{
if ( document.all )
{
document.all[ "..." ].value = "...";
}
else
{
alert( "You're doomed" );
}
}

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Jun 14 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Chris Dean | last post by:
Hi everyone, I'm not a javascript person myself but want to replicate the javascript at the bottom of this page on the microsoft website and include it on my website as a quick "was this...
84
by: Patient Guy | last post by:
Which is the better approach in working with Javascript? 1. Server side processing: Web server gets form input, runs it into the Javascript module, and PHP collects the output for document prep....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.