-1

I want to detect all browser (Safari, Chrome, IE, Firefox and Opera browser) and show welcome message (like "welcome to opera") onload with javascript.

user3932382
  • 35
  • 2
  • 11
  • Take a look: http://jsfiddle.net/ChristianL/AVyND/ – Manwal Jan 28 '15 at 05:20
  • have a look at something like http://faisalman.github.io/ua-parser-js/ – haxxxton Jan 28 '15 at 05:20
  • Why do you want to do that? See http://stackoverflow.com/questions/13478303/correct-way-to-use-modernizr-to-detect-ie. This might help: http://rafael.adm.br/css_browser_selector/. See also http://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser. –  Jan 28 '15 at 05:22

1 Answers1

0

hope this help you..

// Browser with version  Detection
navigator.sayswho= (function(){
    var N= navigator.appName, ua= navigator.userAgent, tem;
    var M= ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
    if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1];
    M= M? [M[1], M[2]]: [N, navigator.appVersion,'-?'];
    return M;
})();

var browser_version          = navigator.sayswho;
alert("Welcome to " + browser_version);

check out the working fiddle ( here )

Hariharan G R
  • 539
  • 2
  • 9