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

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.Browser 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********@hotmail.com
http://www.nathansokalski.com/

Mar 10 '06 #1
4 1286
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********@hotmail.com> schreef in bericht
news:ub**************@TK2MSFTNGP09.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.Browser 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********@hotmail.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********@hotmail.com
http://www.nathansokalski.com/

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:up**************@TK2MSFTNGP11.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********@hotmail.com> schreef in bericht
news:ub**************@TK2MSFTNGP09.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.Browser 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********@hotmail.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**************@TK2MSFTNGP11.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********@hotmail.com> schreef in bericht
news:ub**************@TK2MSFTNGP09.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.Browser 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********@hotmail.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.Browser 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:
ActiveXControlstrue
AOLfalse
BackgroundSoundstrue
Betafalse
BrowserIE
CDFfalse
ClrVersion
Cookiestrue
Crawlerfalse
EcmaScriptVersion1.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********@hotmail.com
http://www.nathansokalski.com/

"Michael Harris (MVP)" <mikhar at mvps dot org> wrote in message
news:OB**************@TK2MSFTNGP14.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**************@TK2MSFTNGP11.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********@hotmail.com> schreef in bericht
news:ub**************@TK2MSFTNGP09.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.Browser 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********@hotmail.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
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...
6
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...
3
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...
4
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...
2
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...
1
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...
1
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...
8
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
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
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...

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.