Created
April 14, 2013 12:20
-
-
Save irazasyed/5382506 to your computer and use it in GitHub Desktop.
JavaScript: Detect Browser
This file contains hidden or 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
| var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; | |
| var is_firefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1; | |
| var is_opera = navigator.userAgent.toLowerCase().indexOf('opera') > -1; | |
| if(is_chrome) { | |
| alert("This message is for Chrome Users!"); | |
| } else if(is_firefox) { | |
| alert("This message is for Firefox Users!"); | |
| } else if(is_opera) { | |
| alert("This message is for Opera Users!"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment