internet-explorerhttp-redirectmicrosoft-edgebannerincompatibility

IE incompatibility banner


Is it possible to have the same banner as on screenshot when users search for my website in IE ? As example, search for apple. However it doesn't work when I search for my website. How to let browser know to open my website in the newest MS Edge browser ?


Solution

  • I try to search but did not get any way to show this same banner with a specific site.

    As a workaround, you can try to use Javascript code to identify the IE browser and display your custom message on your own site.

    Example:

    function Detect_IE() {
               var ua = window.navigator.userAgent;
             
               var msie = ua.indexOf('MSIE ');
               if (msie > 0) {
                
                 return "IE " + parseInt( ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
               }
             
               var trident = ua.indexOf('Trident/');
               if (trident > 0) {
                
                 var rv = ua.indexOf('rv:');
                 return "IE " + parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
               }
    
               // other browser
               return "false";
             }
             var result=Detect_IE();
             if (result=="false")
             {
                document.getElementById("info").innerHTML +="<h2>Welcome to the site...</h2>";
             }
             else
             {
                document.getElementById("info").innerHTML += "<h2>Dear user you are using " + result + " This browser is outdated and not supported by this site. Kindly use supported browser...</h2>";
             }
    <div id="info"></div><br>
    <h2>Test Page...</h2>

    Output in the IE 11:

    enter image description here

    Note that this code will work from IE 7 to IE 11 versions.

    If it is an IE browser then it will show the above message else it will display welcome text.

    Further, you can modify the sample code as per your own requirements.