Thursday, February 20, 2014

How to detect if browser is ie6 or ie7 r ie8 ?(ie=internet explorer)

Solution :
(function ($) {
                "use strict";

                // Detecting IE
                var oldIE;
                if ($('html').is('.ie6, .ie7, .ie8')) {
                    oldIE = true;
                }

                if (oldIE) {
                    alert("its old..");
                } else {
                    alert("you are good");
                }

            }(jQuery));



or 

just add this code on the top :

 <!doctype html>
    <!--[if IE 8]>
<script type="text/javascript">
    alert("ie8");
</script>
<![endif]-->
    <!--[if  gte IE 8]> <html > <script>alert("greater than ie 9 ");</script>  <![endif]-->
    <!--[if lt IE 9]> <html > <script>alert("low than ie 9 .Please upgrade");</script> <![endif]-->
    <!--[if !IE]> <html > <script>alert("Not IE");</script><!-->
    <html lang="en">
    <!--<![endif]-->
    <!-- BEGIN HEAD -->

    <head>
/* here starts your code*/

No comments:

Post a Comment