Learn Javascript

Get Browser Name With Javascript

Sometimes on our app need get user browser name for logging or else. If we using php or nodeJS it many library can handle it. But what if we need that in HTML & javascript only. Then this is pure JavaScript solution hope can help your problem. I tried on different browsers. It is working fine.

You can use navigator.appName and navigator.userAgent properties. The userAgent property is more reliable than appName because for example, Firefox (and some other browsers) may return the string “Netscape” as the value of navigator.appNam for compatibility with Netscape Navigator.

Note, however, that navigator.userAgent may be spoofed, too – that is, clients may substitute virtually any string for their userAgent. Therefore, whatever we deduce from either appName or userAgent should be taken with a grain of salt.

The output will return like this :

[xyz-ihs snippet=”get-browser”]

Leave a Comment

Your email address will not be published. Required fields are marked *