-2

i want detect diffrent borwsers and version with javascript or jquery but i dont getting anything on it.

I need the code to recognize the user browser and redirect to download the addon.

detect all browers like

  • crome
  • mozilla
  • safari
  • ie7,ie8,ie9
  • opera

please help me.

jignesh kheni
  • 1,150
  • 1
  • 7
  • 22

4 Answers4

3
<!DOCTYPE html>
<html>
<body>
<div id="example"></div>

<script>

txt = "<p>Browser CodeName: " + navigator.appCodeName + "</p>";
txt+= "<p>Browser Name: " + navigator.appName + "</p>";
txt+= "<p>Browser Version: " + navigator.appVersion + "</p>";
txt+= "<p>Cookies Enabled: " + navigator.cookieEnabled + "</p>";
txt+= "<p>Browser Language: " + navigator.language + "</p>";
txt+= "<p>Browser Online: " + navigator.onLine + "</p>";
txt+= "<p>Platform: " + navigator.platform + "</p>";
txt+= "<p>User-agent header: " + navigator.userAgent + "</p>";
txt+= "<p>User-agent language: " + navigator.systemLanguage + "</p>";

document.getElementById("example").innerHTML=txt;

</script>

</body>
</html>

Refer This to Know More

Milind Anantwar
  • 77,788
  • 22
  • 86
  • 114
0

Check this site: http://www.quirksmode.org/js/detect.html. It contains a JS function which detects you browser and version.

Jacob
  • 5,004
  • 18
  • 67
  • 130
0

browserdetect.js

Use the above link to download browserdetect.js to detect browser. You just need to call and function and it will return the browser for you and it's version too.

0
var agent = navigator.userAgent;
var browsers = ['Chrome', 'Firefox', 'MSIE 6', 'MSIE 7', 'MSIE 8', 'MSIE 9', 'MSIE 10'];
for (i=0;i<browsers.length;i++){
    if(agent.indexOf(browsers[i]) != -1){
        alert(browsers[i]);
    }
}