Created
February 3, 2014 08:14
-
-
Save Davidslv/8780370 to your computer and use it in GitHub Desktop.
jQuery bad code for browser detection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Bad Code from Efytimes: | |
// http://efytimes.com/e1/fullnews.asp?edid=128774 | |
// Please don't use this code in your website if you have jQuery > 1.9 | |
$(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) | |
{ | |
// DON'T USE THIS, it will return undefined and your code will never run here. | |
// $.browser.webkit is the right one, same applies for $.browser.safari, use `webkit` | |
} | |
// 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 | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment