Sunday 3 April 2011

Javascript to find IE Version

use following script

<script type="text/javascript">
            function onloadFunctions(){
                var isIEGth6 = getIEVersionNumber() >6;
                var browserName=navigator.appName;
                //if browser == IE && Version  <=6  image will be override with text
                if (browserName=="Microsoft Internet Explorer" && !isIEGth6) {
                   //do something
                }
            
            }

            function getIEVersionNumber() {
                var ua = navigator.userAgent;
                var MSIEOffset = ua.indexOf("MSIE ");

                if (MSIEOffset == -1) {
                    return 0;
                } else {
                    return parseFloat(ua.substring(MSIEOffset + 5, ua.indexOf(";", MSIEOffset)));
                }
            }
        </script>

No comments:

Post a Comment