W3Schools.com

Document documentMode Property

Document Object Reference Document Object

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

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

Syntax

document.documentMode


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The documentMode is an IE only property, supported in IE8+.


Example

Example

Return the mode used by the browser to render the current document:

<html>
<body>

This document is displayed in:
<script type="text/javascript">
document.write(document.documentMode);
</script>

</body>
</html>

Try it yourself »


Document Object Reference Document Object
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$3.98 Unlimited Hosting
Premium Website Design
WEB BUILDING
Download XML Editor
FREE Website BUILDER
Best Website Templates Top CSS Templates
CREATE HTML Websites
EASY WEBSITE BUILDER
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE