You might want to create a website in the latest technology stack which works perfectly in all browsers and suddenly when you open it on Internet Explorer you may shout “What a holy shit! The site is not working at all”. The problem is with the Internet Explorer which Microsoft has stopped its support, even the Microsoft Security Chief says that the Internet Explorer is not a browser.
How to detect Internet Explorer?
Please see the code below:
userAgent function so it is supported by all browsers.
From the above script you can not only detect Internet Exploerer but can also detect other browsers as well.
Just need to replace the value of
indexOf() according to the required browser as below:
- Internet Explorer:
Using this code you can detect the browser and can display an alert message to change the browser or whatever you want.