How do I prevent an element from viewing in Microsoft Edge and Internet Explorer?

Asked

Viewed 36 times

0

microsoft browser breaks my site, that’s why it’s Windows/bootstrap, imagine if it wasn’t, I have nothing against microsoft, I just need to cover the site in black and display the message not supported, it gives me time to tidy up or make a version only for this browser

I tried that, but it comes to nothing

<!--[if IE]>

    <script type="text/javascript">
        alert('Voce está rodando essa pagina no Internet Explorer');
    </script>

<![endif]-->

<script type="text/javascript">
var isIE = /*@cc_on!@*/false || !!document.documentMode;
if(isIE == true){
    var ie = '<style>body{background-color:black:!important; .did{color:white:!important;} </style><div><center><h1 class="did"> nao suportado</h1><center></div>';
}else{
     var ie = '';
}
</script>

1 answer

1


Assign an ID to the body or to a div master who compose all valid content, then you create a . css and call it in the page header the way you did. Then you create a div with the message and background that you want to be displayed, however, with hidden pattern using display: none;.

<!--[if IE]>
    <link rel="stylesheet" type="text/css" href="meudeemergencia.css" />
<![endif]-->

Within css, you show the div of the message and hide the one you want:

// CSS para IE

#corpoSite{
    display: none ! important;
}

#divComMensagemErro{
    display: block ! important;
    width: 100vw ! important;
    height: 100vh ! important;
    background-color: rgba(0,0,0,0); 
}
<div id="divComMensagemErro"> <!-- Esta div mostra o erro -->
 <p>Navegador não suportado</p>
</div>

<div id="corpoSite"> <!-- Esta div comporta toda página -->
 <p>Navegador suportado, site rodando belezinha</p>
</div>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.