IE7 detection, issues, redirect ?

Discussion in 'Web Design and Development' started by sk3pt1c, May 10, 2010.

  1. sk3pt1c macrumors 6502a

    sk3pt1c

    Joined:
    Nov 29, 2005
    Location:
    a simulacrum
    #1
    hi there, i've made a site that looks like crap on IE7 (of course),
    so i'd like to detect ie7 and redirect to a page that tells users to
    upgrade their browsers.
    i know i can provide an alternate stylesheet for ie7 users, but for
    this specific site, i'd like to just redirect to a page i've made with that
    notification on it.
    thanks :D

    also, for some reason, this:

    Code:
    <!--[if lte IE 7]<link rel="stylesheet" href="ie7.css"/>[endif]-->
    doesn't seem to work...
     
  2. sk3pt1c thread starter macrumors 6502a

    sk3pt1c

    Joined:
    Nov 29, 2005
    Location:
    a simulacrum
    #2
    right, tried various different methods, but the only one that worked is this:

    Code:
    <script language="JavaScript"><!--
    if (navigator.userAgent.toLowerCase().indexOf('7.0') != -1) {
    document.write("<link rel='stylesheet' href='ie7.css' type='text/css'>");
    }
    
    // --></script>
     
  3. splitpea macrumors 6502a

    Joined:
    Oct 21, 2009
    Location:
    Among the starlings
    #3
    That's because IE sees that as a comment too. Try:

    Code:
    <!--[if lte IE 7][B]>[/B]<link rel="stylesheet" href="ie7.css"/>[B]<![/B][endif]-->
     
  4. plinden macrumors 68040

    plinden

    Joined:
    Apr 8, 2004
    #4

Share This Page