Skip to content

Instantly share code, notes, and snippets.

@yugaego
Created September 1, 2016 12:02
Show Gist options
  • Save yugaego/5e5c521d4117a61de230af6532e926ae to your computer and use it in GitHub Desktop.
Save yugaego/5e5c521d4117a61de230af6532e926ae to your computer and use it in GitHub Desktop.
Javasciprt Identify Browser

http://stackoverflow.com/questions/5899783/detect-safari-using-jquery

    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;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment