How to get Window object from document object in Javascript

document.defaultView

document.defaultView returns the Window object.

Example


<!DOCTYPE HTML> 
<html> 
    <body> 
        <script type="text/javascript"> 
            document.writeln(window.outerWidth); 
            document.writeln(document.defaultView.outerHeight); 
        </script> 
    </body> 
</html><!--  www  .ja  va2  s. c  o  m-->

Click to view the demo





















Home »
  Javascript »
    Javascript Reference »




Array
Canvas Context
CSSStyleDeclaration
CSSStyleSheet
Date
Document
Event
Global
History
HTMLElement
Input Element
Location
Math
Number
String
Window