If Internet Explorer Show/Hide
If the users browser is Internet Explorer show or hide elements on your Webflow site with this Javascript snippet. This allows you to display warning messages, remove elements that aren't IE friendly and other similar use cases.
If the users browser is Internet Explorer show or hide elements on your Webflow site with this Javascript snippet. This allows you to display warning messages, remove elements that aren't IE friendly and other similar use cases.
How to add it
- Add the Javascript code snippet to your closing body tag in your custom code settings.
The code
Javascript
<!-- Add to closing body section -->
<script>
function GetIEVersion() {
var sAgent = window.navigator.userAgent;
var Idx = sAgent.indexOf("MSIE");
// If IE, return version number.
if (Idx > 0){
return parseInt(sAgent.substring(Idx+ 5, sAgent.indexOf(".", Idx)));
}
// If IE 11 then look for Updated user agent string.
else if (!!navigator.userAgent.match(/Trident\/7\./)){
return 11;
}
else{
return 0; //It is not IE
}
}
var e = document.getElementById('ie');
var e2 = document.getElementById('normal');
if (GetIEVersion() > 0){
e.style.display = 'block';
e2.style.display = 'none';
}
else{
e.style.display = 'none';
e2.style.display = 'block';
}
</script>