Get Name Brouser


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function getNameBrouser() {
  2. var ua = navigator.userAgent.toLowerCase();
  3. // Определим Internet Explorer
  4. if (ua.indexOf("msie") != -1 && ua.indexOf("opera") == -1 && ua.indexOf("webtv") == -1) {
  5. return "msie"
  6. }
  7. // Opera
  8. if (ua.indexOf("opera") != -1) {
  9. return "opera"
  10. }
  11. if (ua.indexOf("chrome") != -1) {
  12. return "chrome";
  13. }
  14. // Gecko = Mozilla + Firefox + Netscape
  15. if (ua.indexOf("gecko") != -1) {
  16. return "gecko";
  17. }
  18. // Safari, используется в MAC OS
  19. if (ua.indexOf("safari") != -1) {
  20. return "safari";
  21. }
  22. // Konqueror, используется в UNIX-системах
  23. if (ua.indexOf("konqueror") != -1) {
  24. return "konqueror";
  25. }
  26. return "unknown";
  27. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.