HTML DOM documentModeProperty
Document Object
Definition and Usage
The documentMode property returns the mode used by the browser to render the document.
IE8 renders pages in different ways, based on the !DOCTYPE or the presence of certain HTML elements.
These elements return values as follows:
- 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
Note:If no !DOCTYPE is specified, IE8 renders the page in IE5 mode.
Syntax
document.documentMode
Browser Support
![]()
![]()
![]()
![]()
![]()
documentMode is an IE browser-specific property, supported in IE8 and later IE versions.
Examples
Examples
Return the mode used by the browser to render the page:
<html>
<body>
This document is displayed in:
<script>
document.write(document.documentMode);
</script>
</body>
</html>
<body>
This document is displayed in:
<script>
document.write(document.documentMode);
</script>
</body>
</html>
Try it Yourself »
Document Object Other Extensions