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

Discussion in 'ASP .Net' started by Nathan Sokalski, Mar 10, 2006.

  1. 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

    http://www.nathansokalski.com/
     
    Nathan Sokalski, Mar 10, 2006
    #1
    1. Advertising

  2. 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" <> schreef in bericht
    news:...
    >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
    >
    > http://www.nathansokalski.com/
    >
    >
    >
     
    Cor Ligthert [MVP], Mar 10, 2006
    #2
    1. Advertising

  3. 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

    http://www.nathansokalski.com/

    "Cor Ligthert [MVP]" <> wrote in message
    news:...
    > 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" <> schreef in bericht
    > news:...
    >>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
    >>
    >> http://www.nathansokalski.com/
    >>
    >>
    >>

    >
    >
     
    Nathan Sokalski, Mar 10, 2006
    #3
  4. 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/author/dhtml/reference/properties/keycode.asp

    "...
    Standards Information

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


    > "Cor Ligthert [MVP]" <> wrote in message
    > news:...
    >> 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" <> schreef in bericht
    >> news:...
    >>> 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
    >>>
    >>> http://www.nathansokalski.com/


    --
    Michael Harris
    Microsoft MVP Scripting

    Scripting: Your First Steps
    http://www.microsoft.com/technet/scriptcenter/topics/beginner/firststeps.mspx
     
    Michael Harris \(MVP\), Mar 11, 2006
    #4
  5. 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

    http://www.nathansokalski.com/

    "Michael Harris (MVP)" <mikhar at mvps dot org> wrote in message
    news:...
    > 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/author/dhtml/reference/properties/keycode.asp
    >
    > "...
    > Standards Information
    >
    > There is no public standard that applies to this property
    > ..."
    >
    >
    >> "Cor Ligthert [MVP]" <> wrote in message
    >> news:...
    >>> 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" <> schreef in bericht
    >>> news:...
    >>>> 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
    >>>>
    >>>> http://www.nathansokalski.com/

    >
    > --
    > Michael Harris
    > Microsoft MVP Scripting
    >
    > Scripting: Your First Steps
    > http://www.microsoft.com/technet/scriptcenter/topics/beginner/firststeps.mspx
    >
    >
    >
     
    Nathan Sokalski, Mar 11, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marvin Massih

    "Keycode DLL not found or invalid keycode"

    Marvin Massih, Dec 31, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    2,159
    Marvin Massih
    Dec 31, 2004
  2. Nathan Sokalski

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

    Nathan Sokalski, Mar 10, 2006, in forum: ASP .Net Building Controls
    Replies:
    4
    Views:
    191
    Nathan Sokalski
    Mar 11, 2006
  3. Perttu Pulkkinen

    Firefox/Mozilla and window.event.keyCode

    Perttu Pulkkinen, Apr 21, 2005, in forum: Javascript
    Replies:
    1
    Views:
    160
    Daniel Kirsch
    Apr 22, 2005
  4. Thomas Christensen

    IE event and keyCode/charCode

    Thomas Christensen, Oct 20, 2005, in forum: Javascript
    Replies:
    4
    Views:
    174
  5. Replies:
    1
    Views:
    91
Loading...

Share This Page