Pages

Saturday, January 28, 2012

Detect Browser in Jquery

Detect Browser in Jquery

Introduction : In this article i will show how to detect browser in Jquery . Many times we require to detect browser and need to do code accordingly as per browser. By using following code you can detect Internet Explorer Browser ,Mozila Browser ,Safari Browser In Jquery

Jquery Code to Detect Browser :
   
<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        if ($.browser.msie) { alert('Internet Explorer and Version is ' + $.browser.version) }
        if ($.browser.safari) { alert('Safari Browser .') }
        if ($.browser.mozilla) { alert('Mozila Browser and Version is ' +  $.browser.version) }
    });    
</script>


Related Other posts

2 comments: