Example
Return the mode used by the browser to render the current document:
var x = document.documentMode;
The result of x could be:
11
Try it Yourself »
More "Try it Yourself" examples below.
Definition and Usage
The documentMode property returns the mode used by the browser to render the current document.
IE8 can render a page in different modes, depending on the !DOCTYPE or the presence of certain HTML elements.
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
Note: If no !DOCTYPE is specified, IE8 renders the page in IE5 mode!
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
documentMode | Not supported | 8.0 | Not supported | Not supported | Not supported |
Note: The documentMode is an IE only property.
Syntax
document.documentMode
< Document Object