473,406 Members | 2,549 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,406 software developers and data experts.

JavaScript ?

WJ
How can my Asp.Net web page check to see if its client browser enables JS ?
Example: I have an Asp.Net Page that supports both Java Script and Non-Java
Script (disabled). On page_load event, I would like to redirect clients who
enable JS in their browser to different web page.

Thanks for your help,

John
Nov 18 '05 #1
5 976
there is a browsercapabilities class embeded in the httprequest class as a
'browser' attribute..
You can query that class for the client browser.


"WJ" <Jo*******@HotMail.Com> wrote in message
news:uC**************@TK2MSFTNGP11.phx.gbl...
How can my Asp.Net web page check to see if its client browser enables JS ? Example: I have an Asp.Net Page that supports both Java Script and Non-Java Script (disabled). On page_load event, I would like to redirect clients who enable JS in their browser to different web page.

Thanks for your help,

John

Nov 18 '05 #2
WJ
"Mr. Dot Net" <Do@Not.Spam> wrote in message
news:OW**************@TK2MSFTNGP11.phx.gbl...
there is a browsercapabilities class embeded in the httprequest class as a
'browser' attribute..
You can query that class for the client browser.


Thanks for your reply. No it does not work. I went into my MS/IE 6.1 Sp1 and
disabled all Java scripts and applets, I also disabled Cookies. Applied the
changes. Get out of MS/IE and got backin to check the browser if these
settings are indeed persisted and they are. But my Asp.Net application still
sees they are set to "true" as indicated by the code below (unless I am
doing somethings wrong):

private void LinkButton1_Click(object sender, System.EventArgs e)
{

Label1.Text=Request.Browser.JavaScript.ToString()+ ":::"+Request.Browser.Java
Applets.ToString()+":::"+Request.Browser.Cookies.T oString();
}
John
Nov 18 '05 #3
Apparently "Mr. Dot Net" should change his name to
"Dr. Don't Have A Clue Yet" ;-) because all the BrowserCapabilities
class can tell us is if the user agent (the browser) *can* support
JavaScript not *if* JavaScript has been enabled or disabled.

Google" "javascript enabled"+"asp.net" and you'll see at least
two articles on the first page of results...

--
<%= Clinton Gallagher
A/E/C Consulting, Web Design, e-Commerce Software Development
Wauwatosa, Milwaukee County, Wisconsin USA
NET csgallagher@ REMOVETHISTEXT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/


"WJ" <Jo*******@HotMail.Com> wrote in message
news:#a**************@TK2MSFTNGP10.phx.gbl...
"Mr. Dot Net" <Do@Not.Spam> wrote in message
news:OW**************@TK2MSFTNGP11.phx.gbl...
there is a browsercapabilities class embeded in the httprequest class as a
'browser' attribute..
You can query that class for the client browser.


Thanks for your reply. No it does not work. I went into my MS/IE 6.1 Sp1 and
disabled all Java scripts and applets, I also disabled Cookies. Applied the
changes. Get out of MS/IE and got backin to check the browser if these
settings are indeed persisted and they are. But my Asp.Net application still
sees they are set to "true" as indicated by the code below (unless I am
doing somethings wrong):

private void LinkButton1_Click(object sender, System.EventArgs e)
{

Label1.Text=Request.Browser.JavaScript.ToString()+ ":::"+Request.Browser.Java
Applets.ToString()+":::"+Request.Browser.Cookies.T oString();
}
John

Nov 18 '05 #4
Dear Mr. Clinton, what a charming personality indeed.

from 4guysinrolla:

"The article Determining if your Visitors have JavaScript and Cookies
Enabled describes a method to test to see if the user has JavaScript AND
cookies enabled.

A second alternative you can use to determine if a user has cookies enabled
(as well as a slew of other options), you can use a third-party component,
like BrowserHawk. Examples on using BrowserHawk to perform Cookie checks can
be seen here. For more information on BrowserHawk be sure to read Ryan S.'s
article: Browser Detection with BrowserHawk and check out the BrowserHawk
Homepage!"
Nov 18 '05 #5
psb
I have the same problem, and the only way I can think of doing this is on
every post back check for a hidden variable that is set by javascript....
....
<head><script><!--function
Loader(){document.form1.tag1.value=1;}--></script></head>
<body onload="Loader();">
<form name="form1"><input type="hidden" name="tag1" value="0"
runat="server"/></form>
....

on post back check,

tag1.value="1"

I haven't implemented in my code, thinking a better solution will present
itself but, none so far.

-Psb

"WJ" <Jo*******@HotMail.Com> wrote in message
news:uC**************@TK2MSFTNGP11.phx.gbl...
How can my Asp.Net web page check to see if its client browser enables JS ? Example: I have an Asp.Net Page that supports both Java Script and Non-Java Script (disabled). On page_load event, I would like to redirect clients who enable JS in their browser to different web page.

Thanks for your help,

John

Nov 18 '05 #6

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

Similar topics

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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.