Javascript to detect an old Internet Explorer and offer to download newer browser(s)

前端 未结 4 1684
甜味超标
甜味超标 2021-01-16 04:22

I\'m looking for something good-loking that I can paste on a page and be done with it.

The script should detect IE versions older than 9 and show a nice popup with l

相关标签:
4条回答
  • 2021-01-16 04:51

    This one offers customizable browser versions, not just for IE but also for Firefox, Opera, Safari. http://browser-update.org/

    0 讨论(0)
  • 2021-01-16 04:55

    I would probably use a comment hack with IE conditional comments to do the version detection.

    <!--[if lt IE 8 ]>
        <script type='text/javascript'>
            alert( 'Your IE is Old' );
    
            // or set a flag or something
    
            var oldIE = true;
        </script>
    <![endif]-->
    

    It's technically not using javascript to do the detection and is rather using a feature inherent to IE but it should work more consistently than a complex javascript function.

    0 讨论(0)
  • 2021-01-16 05:05

    When I first posted this answer, the modern.IE project were pushing the IE6 countdown initiative, part of which was the provision of a IE detection snippet and hosted image used to warn users that they're using an old browser.

    I originally linked to http://www.ie6countdown.com/ which now redirects to an area on modern.IE which no longer provides the snippet and image. So, for prosperity and reference, here is the code they were sharing and the original banner image hosted on imgur:

    <!--[if lt IE 7]>
    <div style=' clear: both; height: 59px; padding:0 0 0 15px; position: relative;'> 
      <a href="http://www.microsoft.com/windows/internet-explorer/default.aspx?ocid=ie6_countdown_bannercode">
        <img src="http://i.imgur.com/hNingci.jpg" border="0" height="42" width="820" alt="" />
      </a>
    </div>
    <![endif]-->
    

    If you want to change this to detect IE versions less than 9 just change the first bit of the code to this:

    <!--[if lt IE 9]>
    
    0 讨论(0)
  • 2021-01-16 05:06

    Recently I developed a free jQuery plugin that shows a well designed warning message to the visitor who's trying to view your site with an older version of Internet Explorer browser.
    Site: http://nmsdvid.com/iealert/

    0 讨论(0)
提交回复
热议问题