S
S
Sergey2019-11-20 20:55:00
css
Sergey, 2019-11-20 20:55:00

How to display a message in IE11 to switch to another browser?

Tried elementary thing in head

<!--[if IE 11]>
<div id="warning">
<h4 class="red" style="color: red;">Your Browser Is Not Supported!</h4><br />
</div>
<![endif]-->

Does not help. The script does not run in IE at all, an endless preloader is spinning. Does it affect? Maybe where else the condition should be written? Or should it look different?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pashenka, 2019-11-20
@DaveGarrow

The preloader is obviously spinning, because you remove it in JS, and JS code has already fallen into IE11 before this moment. As an option at the very beginning of the JS file, check

function detectIE() {
    var ua = window.navigator.userAgent;
    var msie = ua.indexOf('MSIE ');

    if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./))  {
        return true;
    }

    return false;
}

if ( detectIE() ) {
    // скрыть прелоадер
    // показать некое сообщение пользователю.
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question