Search code examples
javascriptjqueryinternet-explorer-11compatibility

Prevent viewing webpage in Internet Explorer


I recently created a web portal and it seems like internet explorer doesn't support all the new css properties in the page. The webpage looks good on the new edge, chrome and firefox. Is there any way that i can block the users from vewing my webpage in internet explorer by putting a message (just my concept)

"webpage not supported in internet explorer use chrome ,firefox or edge"

Thanks a lot for your time.


Solution

  • You can use the following Javascript validation. If Internet Explorer is detected a message will be shown to the user and it will then redirect to your custom error page. Modify the variable 'errURL' to reflect your custom error page URL.

    var msg = "webpage not supported in internet explorer use chrome ,firefox or edge"; 
    var errURL = "https://www.google.com"; 
    var ua = window.navigator.userAgent; 
    
    if(ua.indexOf('Trident') > -1 || ua.indexOf('MSIE') > -1){
      alert(msg); document.location(errURL);
    }