1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Get User Agent?

Discussion in 'Programming' started by soapbath, May 28, 2005.

  1. #1
    What Code (Javascript, PHP, ASP?) would I need to be able to get the user agent and display in. In Cpanel "Latist visitors" it shows:

    But the only code I know says just simple

    So how can I get the indepth infomation?
     
    soapbath, May 28, 2005 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    In PHP it's easy... it's a super global variable...
    $_SERVER['HTTP_USER_AGENT']
    PHP:
    To define the variable agent with the user agent, it's like so in JavaScript:
    var agent=navigator.userAgent
    Code (markup):
     
    digitalpoint, May 28, 2005 IP
    sp360 likes this.
  3. soapbath

    soapbath Peon

    Messages:
    909
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks Alot Digitalpoint.
     
    soapbath, May 28, 2005 IP
  4. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #4
    Also, I *think* (not 100% sure though) in ASP it's:
    request.servervariables("http_user_agent")
    Code (markup):
     
    digitalpoint, May 28, 2005 IP
  5. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #5
    It is, however, only VB is case-insensitive. If you use any other language (JavaScript, C#, etc), you have to write

    Request.ServerVariables("HTTP_USER_AGENT")

    J.D.
     
    J.D., May 28, 2005 IP
  6. dsr771

    dsr771 Peon

    Messages:
    65
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    In Javascript you can use:

    document.write(navigator.userAgent)

    also:
    document.write(navigator.appName)
    document.write(navigator.appVersion)
    document.write(navigator.platform)
    document.write(document.lastModified)
     
    dsr771, May 31, 2005 IP