lundi 30 avril 2018

Javascript: detect if browser is IE, then hide HTML

I want to create a JaveScript to hide the html if the visitor is using browser IE. I did some research in Stackover and the below is what I come up. It doesn't work at the end. Can anyone tell me what I did wrong? Thanks!'

HTML:

<div id="content">
Hello
</div>

JS:

var isIE = /*@cc_on!@*/false || !!document.documentMode;


if (isIE === 'true') {
  function display() {
    document.getElementById('content').style.display="none";
}
}

Aucun commentaire:

Enregistrer un commentaire