Results 1 to 4 of 4

Thread: Browser detect script

  1. #1
    Join Date
    Jul 2007
    Location
    New Zealand
    Posts
    81
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Browser detect script

    Due to the hassles I am having with IE 5.5 and lower displaying information correctly as I am now using CSS validated code, I need to be able to detect if a surfer is viewing the page via one of these browsers so it can display a message advising the page won't display correctly and strongly recommend upgrade or switch to a different browser (such as FF or Opera).

    All I have found so far in my search is cheesy browser detect scripts that advise what browser you're using. I don't want to annoy my surfers, but I do want to advise them ONLY if their browser doesn't pass that the page will not display correct. I don't want to redirect them anywhere and would prefer if it didn't pop up in a window, but rather sat just below my navigation. Is js the best thing to use or would a php script be better? Thanks.

  2. #2
    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

    If you aren't too worried about folks surfing with an IE browser less than 5 - hardly anyone is using IE 4.x anymore, and even if they are, they know it is a piece of crap, you can just use a conditional:

    HTML Code:
    <!--[if lt IE 6]>
    Whatever you'd like to tell the poor souls goes here.
    <![endif]-->
    No script, PHP, etc. required. IE 5 through and including 5.x will see that, no one else will. It's ordinary HTML to those browsers, a comment to all others.

    If you really mean precisely IE 5.5 and less (I don't think there was a version between that and 6), you can use:

    HTML Code:
    <!--[if lte IE 5.5]>
    Whatever you'd like to tell the poor souls goes here.
    <![endif]-->
    - John
    ________________________

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

  3. #3
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    And if you want to praise the happy souls that don't use IE, put this:

    <!--[if !IE]><!-->
    You are sooo lucky. You don't use IE! Praising... praising ...
    <!--<![endif]-->

    Arie Molendijk.

  4. #4
    Join Date
    Jul 2007
    Location
    New Zealand
    Posts
    81
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default

    That's exactly what I was after. Not a nagging javascript prompt window. Thank you! I couldn't seem to find anything like this. You're both stars!

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
  •