Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I detect IE and Edge browser?

Can't get Parallax working properly in IE or Microsoft Edge. I've looked in forums and haven't found a solution to the problem. I've come up with hopefully a solution for now. I want to make a message appear if the user is using IE or Edge. Not sure how I can detect that the browser being used is one or the either.

Here is some javascript code I'm trying to work with:

<script src="https://github.com/ded/bowser/blob/master/src/bowser.js"></script>      // Determine Browser Used browser = require('bowser').browser; becomes browser = require('bowser'); if (bowser.msie || bowser.msedge) {   alert('Hello Microsoft User'); } 

Any help would be appreciated or if there is a better solution.

http://peaceandplentyinn.mybnbwebsite.com

like image 894
Brent Nicolet Avatar asked Oct 15 '15 15:10

Brent Nicolet


People also ask

Can I have both Internet Explorer and Microsoft Edge?

If any site you visit needs Internet Explorer 11, you can reload it with Internet Explorer mode in Microsoft Edge. The same Internet Explorer 11 apps and sites you use today can open in Microsoft Edge with Internet Explorer mode. Microsoft Edge is the faster, more secure browser recommended by Microsoft.

Is Microsoft Edge and Internet Explorer the same browser?

The Edge icon, a blue letter "e," is similar to the Internet Explorer icon, but they are separate applications. To open Internet Explorer, open the Windows menu in the lower left corner of your screen and begin typing "Internet Explorer." IE will pop up in a search menu.


1 Answers

I doubt you really need to detect the browser. But here it is anyway (don't really need to use a library):

// detect IE8 and above, and edge if (document.documentMode || /Edge/.test(navigator.userAgent)) {     alert('Hello Microsoft User!'); } 
like image 197
Reda Avatar answered Oct 02 '22 14:10

Reda