Skip to content

Instantly share code, notes, and snippets.

@myvitaliy
Created March 2, 2017 08:41
Show Gist options
  • Save myvitaliy/cab961135a068c97d4c4e024015fb24f to your computer and use it in GitHub Desktop.
Save myvitaliy/cab961135a068c97d4c4e024015fb24f to your computer and use it in GitHub Desktop.
Скрипт определения браузера
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;}
/* end detect browser*/
if(is_opera) {
$('body').addClass('is_opera');
}
if(is_chrome) {
$('body').addClass('is_chrome');
}
if(is_firefox) {
$('body').addClass('is_firefox');
}
if(is_safari) {
$('body').addClass('is_safari');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment