473,786 Members | 2,420 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Determining the Browser and event.keyCode vs. event.which

I am writing a piece of code for an ASP.NET function that generates an
onKeyPress JavaScript eventhandler that uses the event.keyCode / event.which
properties. I have two situations that I would appreciate any advice on:

1. I know that IE uses event.keyCode to get the key pressed. I have,
however, seen sites that some versions of Netscape use event.which and some
versions use event.keyCode. Does anyone know of a site that lists which one
all the versions of as many of the existing browsers as possible use?

2. I need to write server-side ASP.NET code in VB.NET to determine which
browser is requesting the page. I know that this is done using the
Page.Request.Br owser object, but because this is the first time I have
needed to worry about the browser all the way down to the specific version,
I want to know the best, simplest, most efficient way to do this.

Thank you to everyone in advance.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

Mar 10 '06 #1
4 1302
Nathan,

This is the only link I still have what maybe covers what I think you are
asking.

http://www.webmonkey.com//reference/browser_chart/

I hope this helps,

Cor

"Nathan Sokalski" <nj********@hot mail.com> schreef in bericht
news:ub******** ******@TK2MSFTN GP09.phx.gbl...
I am writing a piece of code for an ASP.NET function that generates an
onKeyPress JavaScript eventhandler that uses the event.keyCode /
event.which
properties. I have two situations that I would appreciate any advice on:

1. I know that IE uses event.keyCode to get the key pressed. I have,
however, seen sites that some versions of Netscape use event.which and
some
versions use event.keyCode. Does anyone know of a site that lists which
one
all the versions of as many of the existing browsers as possible use?

2. I need to write server-side ASP.NET code in VB.NET to determine which
browser is requesting the page. I know that this is done using the
Page.Request.Br owser object, but because this is the first time I have
needed to worry about the browser all the way down to the specific
version,
I want to know the best, simplest, most efficient way to do this.

Thank you to everyone in advance.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

Mar 10 '06 #2
It's a nice chart, but unfortunately it does not have the information I am
looking for. I am trying to determine what browsers use event.keyCode and
what browsers use event.which (these both refer to the ascii code of the key
pressed to trigger JavaScript events such as onKeyPress).
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

"Cor Ligthert [MVP]" <no************ @planet.nl> wrote in message
news:up******** ******@TK2MSFTN GP11.phx.gbl...
Nathan,

This is the only link I still have what maybe covers what I think you are
asking.

http://www.webmonkey.com//reference/browser_chart/

I hope this helps,

Cor

"Nathan Sokalski" <nj********@hot mail.com> schreef in bericht
news:ub******** ******@TK2MSFTN GP09.phx.gbl...
I am writing a piece of code for an ASP.NET function that generates an
onKeyPress JavaScript eventhandler that uses the event.keyCode /
event.which
properties. I have two situations that I would appreciate any advice on:

1. I know that IE uses event.keyCode to get the key pressed. I have,
however, seen sites that some versions of Netscape use event.which and
some
versions use event.keyCode. Does anyone know of a site that lists which
one
all the versions of as many of the existing browsers as possible use?

2. I need to write server-side ASP.NET code in VB.NET to determine which
browser is requesting the page. I know that this is done using the
Page.Request.Br owser object, but because this is the first time I have
needed to worry about the browser all the way down to the specific
version,
I want to know the best, simplest, most efficient way to do this.

Thank you to everyone in advance.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/


Mar 10 '06 #3
Nathan Sokalski wrote:
It's a nice chart, but unfortunately it does not have the information
I am looking for. I am trying to determine what browsers use
event.keyCode and what browsers use event.which (these both refer to
the ascii code of the key pressed to trigger JavaScript events such
as onKeyPress).
Probably only IE uses event.keyCode.. .

keyCode Property (event) (Internet Explorer - DHTML)
http://msdn.microsoft.com/workshop/a...es/keycode.asp

"...
Standards Information

There is no public standard that applies to this property
...."

"Cor Ligthert [MVP]" <no************ @planet.nl> wrote in message
news:up******** ******@TK2MSFTN GP11.phx.gbl...
Nathan,

This is the only link I still have what maybe covers what I think
you are asking.

http://www.webmonkey.com//reference/browser_chart/

I hope this helps,

Cor

"Nathan Sokalski" <nj********@hot mail.com> schreef in bericht
news:ub******** ******@TK2MSFTN GP09.phx.gbl...
I am writing a piece of code for an ASP.NET function that generates
an onKeyPress JavaScript eventhandler that uses the event.keyCode /
event.which
properties. I have two situations that I would appreciate any
advice on: 1. I know that IE uses event.keyCode to get the key pressed.
I have,
however, seen sites that some versions of Netscape use event.which
and some
versions use event.keyCode. Does anyone know of a site that lists
which one
all the versions of as many of the existing browsers as possible
use? 2. I need to write server-side ASP.NET code in VB.NET to determine
which browser is requesting the page. I know that this is done
using the Page.Request.Br owser object, but because this is the
first time I have needed to worry about the browser all the way
down to the specific version,
I want to know the best, simplest, most efficient way to do this.

Thank you to everyone in advance.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/


--
Michael Harris
Microsoft MVP Scripting

Scripting: Your First Steps
http://www.microsoft.com/technet/scr...irststeps.mspx

Mar 11 '06 #4
Well, that's good to know, it should somewhat simplify what I need to test
for. When experimenting with ASP.NET's Page.Request.Br owser object, which is
what I plan to use to determine whether to sent JavaScript that uses
event.which or event.keyCode, I generated the following page:
ActiveXControls true
AOLfalse
BackgroundSound strue
Betafalse
BrowserIE
CDFfalse
ClrVersion
Cookiestrue
Crawlerfalse
EcmaScriptVersi on1.2
Framestrue
JavaAppletstrue
JavaScripttrue
MajorVersion6
MinorVersion.0
MSDomVersion6.0
PlatformWinXP
Tablestrue
TypeIE6
VBScripttrue
Version6.0
W3CDomVersion1. 0
Win16false
Win32true
GetClrVersions( )1.1.4322, 2.0.50727

I am assuming that I would use either the Browser or Type properties to
determine the user's browser. What are the different values that would be
returned by the different browsers (so I know what different values to test
for, particularly the less well known browsers) in the Browser and Type
properties? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

"Michael Harris (MVP)" <mikhar at mvps dot org> wrote in message
news:OB******** ******@TK2MSFTN GP14.phx.gbl...
Nathan Sokalski wrote:
It's a nice chart, but unfortunately it does not have the information
I am looking for. I am trying to determine what browsers use
event.keyCode and what browsers use event.which (these both refer to
the ascii code of the key pressed to trigger JavaScript events such
as onKeyPress).


Probably only IE uses event.keyCode.. .

keyCode Property (event) (Internet Explorer - DHTML)
http://msdn.microsoft.com/workshop/a...es/keycode.asp

"...
Standards Information

There is no public standard that applies to this property
..."

"Cor Ligthert [MVP]" <no************ @planet.nl> wrote in message
news:up******** ******@TK2MSFTN GP11.phx.gbl...
Nathan,

This is the only link I still have what maybe covers what I think
you are asking.

http://www.webmonkey.com//reference/browser_chart/

I hope this helps,

Cor

"Nathan Sokalski" <nj********@hot mail.com> schreef in bericht
news:ub******** ******@TK2MSFTN GP09.phx.gbl...
I am writing a piece of code for an ASP.NET function that generates
an onKeyPress JavaScript eventhandler that uses the event.keyCode /
event.which
properties. I have two situations that I would appreciate any
advice on: 1. I know that IE uses event.keyCode to get the key pressed.
I have,
however, seen sites that some versions of Netscape use event.which
and some
versions use event.keyCode. Does anyone know of a site that lists
which one
all the versions of as many of the existing browsers as possible
use? 2. I need to write server-side ASP.NET code in VB.NET to determine
which browser is requesting the page. I know that this is done
using the Page.Request.Br owser object, but because this is the
first time I have needed to worry about the browser all the way
down to the specific version,
I want to know the best, simplest, most efficient way to do this.

Thank you to everyone in advance.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/


--
Michael Harris
Microsoft MVP Scripting

Scripting: Your First Steps
http://www.microsoft.com/technet/scr...irststeps.mspx

Mar 11 '06 #5

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

Similar topics

3
4973
by: Greg | last post by:
I want to be able to capture the user pressing Ctrl+S. I know that the IE browser has a key binding for Ctrl+S but is there any way that I can be notified of this key press anyway. I have found tons of examples of capturing keys in IE but *none* of them work for capturing Ctrl+S, Ctrl+F, Ctrl+P,etc or any key combination that has a binding in IE. Does anyone know how to do this?
6
14908
by: rich_poppleton | last post by:
Help.... I've got a textarea where people type in a description. However for certain reasons we need to stop them typing !$*^ . I have a solution this which works fine in IE: function keypress() {
3
4006
by: PJ6 | last post by:
I can probably do this by mapping out all the number and letter key codes... but I was just wondering if there is a built-in JavaScript function that can determinine if the key pressed in the keydown event is a letter or a digit. Or, more specifically to my functional requirement, a key that will affect the contents of an input of type text. So I guess that plus backspace and delete. TIA, Paul
4
2007
by: Nathan Sokalski | last post by:
I am writing a piece of code for an ASP.NET function that generates an onKeyPress JavaScript eventhandler that uses the event.keyCode / event.which properties. I have two situations that I would appreciate any advice on: 1. I know that IE uses event.keyCode to get the key pressed. I have, however, seen sites that some versions of Netscape use event.which and some versions use event.keyCode. Does anyone know of a site that lists which one...
2
11771
by: mattgarvin | last post by:
Hello, I need a piece of javascript that will allow a form to be submitted when Enter is pressed for IE6 and 7, Firefox 2, and recent versions of Safari. It is for a login page that has two textboxes: a "Login" and a "Password". The "Login Button" is actually a standard image with an onClick event handler to submit the form, because we use a mouseover effect. (That is, it is not INPUT TYPE="IMAGE" but rather an IMAGE tag with...
1
15668
by: acl123 | last post by:
Hi, I am trying to work out how to access the event object in firefox under two conditions - 1) Attaching event handlers in javascript, not html. 2) The event handler requires parameters in addition to the event object. Here is an HTML page that demonstrates the problem. Notice that it works in IE but not firefox.
1
2481
by: mark4asp | last post by:
<!-- // How to detect the rendering mode which the browser is currently in (works for IE6). // Ctrl+Shift+s displays indicates whether the browser is in quirks or standards mode. // Detect keypress var captureKeys = function(ev) { ev = ev || window.event; // gets the event in ie or ns kCode = ev.keyCode || ev.which; // gets the keycode in ie or ns
8
5536
by: Ciaran | last post by:
Hi has anyone got a function that can detect a user pressing a key that works cross browser? I just want to redirect my visitor if they hit escape ... you'd think it would be easy! Thanks, Ciarán
13
5657
by: Gouri.Mahajan7 | last post by:
Hello, Can anybody please tell me how to trap the browser close event. when that is fired I want to call the web method. Thanks in advance. Regards, Gouri.
0
9496
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9961
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3669
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.