Want to know determine browser using jQuery? Use this simple jQuery snippet to detect which browser your site is being viewed on.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | $(document).ready(function() { // If the browser type if Mozilla Firefox if ($.browser.mozilla && $.browser.version >= "1.8" ){ // some code } // If the browser type is Opera if( $.browser.opera) { // some code } // If the web browser type is Safari if( $.browser.safari ) { // some code } // If the web browser type is Chrome if( $.browser.chrome) { // some code } // If the web browser type is Internet Explorer if ($.browser.msie && $.browser.version <= 6 ) { // some code } //If the web browser type is Internet Explorer 6 and above if ($.browser.msie && $.browser.version > 6) { // some code } }); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.