This code is based on the article from MDN. Where they gave a brief hint about various keywords that can be used to detect the browser name and device type (Mobile/Desktop).
The data shown in the image above is not sufficient for detecting all the browsers
e.g. userAgent of Firefox will have Fxios as a keyword rather than Firefox.
A few changes are also done to detect browsers like Edge and UCBrowser
The code is currently tested for the following browsers by changing userAgent with the help of dev-tools (How to change userAgent):
- FireFox
- Chrome
- IE
- Edge
- Opera
- Safari
- UCBrowser