-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.

5
  • 2
    Have you even tried to find the information yourself? There is ample amounts of resources and information regarding this Commented Nov 20, 2013 at 12:43
  • w3schools.com/js/tryit.asp?filename=try_nav_all Commented Nov 20, 2013 at 12:44
  • Press F12, go to console, type navigator.userAgent, profit Commented Nov 20, 2013 at 12:45
  • search result will give link of external js which i don't want i need to simple function of it. i do not want to add external js @RoryPicko92 Commented Nov 20, 2013 at 12:56
  • @jigneshkheni external js? js is js Commented Nov 20, 2013 at 13:34

4 Answers 4

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

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

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.

Comments

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]);
    }
}

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.