Results 1 to 4 of 4

Thread: A script which detects browser version ?

  1. #1
    Join Date
    Aug 2006
    Posts
    44
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default A script which detects browser version ?

    Hello,

    I would like to use ThickBox script in my Web page (http://jquery.com/demo/thickbox/), but this script is supported on Safari 2.0.4+ and my Web page has to be compatible with Safari 2.0.3 too!

    Do you know a script which detects browser version?

    A script which allows to use a specific code line depending of the browser version, like:

    if Safari 3 and other browsers (IE, FF, Opera...) =
    <a href="ajaxOverFlow.html?height=300&width=300" title="add a caption to title attribute / or leave blank" class="thickbox">Scrolling content</a>
    (ThickBox code)

    if Safari 2 =
    <a href="test.html" target="_parent">test</a>
    (classic code)

    Thanks a lot your help
    Chris
    Last edited by chrbar; 05-04-2008 at 08:41 PM.

  2. #2
    Join Date
    May 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    there is a code which you can put in to detect which browser the user is using

    if(navigator.appName == "Microsoft Internet Explorer")
    {
    alert("You are using Internet Explorer you may need to activate Active X before you can check your answers. If there is still a problem try using another broswer! If theres no problem ENJOY THE GAME!")
    }
    else alert("Your not using Internet Explorer so enjoy playing the quiz!");

    that will alert the user what browser is being used but you can change it so if the user is using safari .... you can put document.write and then express what you want the java to do.

    Hope this helps a bit

  3. #3
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Though tempting, browser detection should generally only be used for a specific browser or browsers that are troublesome in some way with your code, and then only as a provisional last resort, with the hope still remaining that a better method of code branching will be determined later. This is because, no matter how good the detect is, things will change in the future. Feature (object) detection is the right way to go.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •