Javascript DOM HTML Document documentMode Property get

Introduction

The documentMode is an IE only property.

Return the mode used to render the current document:

var x = document.documentMode;

The documentMode property is only supported in Internet Explorer, from IE8+.

View in separate window

<!DOCTYPE html>
<html>
<body>
<p>This document is displayed in IE<span id="demo"></span> mode.</p>
<script>
var x = document.documentMode;
document.getElementById("demo").innerHTML = x;
</script>//from  ww  w.j  a va  2 s. c om

</body>
</html>

The documentMode property returns the mode used by the browser to render the current document.

This property returns one of following values:

  • 5 - The page is displayed in IE5 mode
  • 7 - The page is displayed in IE7 mode
  • 8 - The page is displayed in IE8 mode
  • 9 - The page is displayed in IE9 mode
  • 10 - The page is displayed in IE10 mode
  • 11 - The page is displayed in IE11 mode

If no !DOCTYPE is specified, IE8 renders the page in IE5 mode!




PreviousNext

Related