Created
December 8, 2017 10:30
-
-
Save monis01/7bc4b76f145da80eee5ce7db019bb207 to your computer and use it in GitHub Desktop.
Detect Browser Type
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.indexOf('Chrome') > -1; | |
var is_explorer = navigator.userAgent.indexOf('MSIE') > -1; | |
var is_firefox = navigator.userAgent.indexOf('Firefox') > -1; | |
var is_safari = navigator.userAgent.indexOf("Safari") > -1; | |
var is_opera = navigator.userAgent.toLowerCase().indexOf("op") > -1; | |
if ((is_chrome)&&(is_safari)) { is_safari = false; } | |
if ((is_chrome)&&(is_opera)) { is_chrome = false; } | |
//@ Or for Safari only | |
if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {alert('Its Safari');} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment