jQuery API

jQuery.isWindow()

jQuery.isWindow( obj ) Returns: boolean

Description: Determine whether the argument is a window.

  • version added: 1.4.3jQuery.isWindow( obj )

    objObject to test whether or not it is a window.

This is used in a number of places in jQuery to determine if we're operating against a browser window (such as the current window or an iframe).

Example:

Finds out if the parameter is a window.

<!DOCTYPE html>
<html>
<head>
  <script src="http://code.jquery.com/jquery-1.4.4.js"></script>
</head>
<body>
  Is 'window' a window? <b></b>
<script>$("b").append( "" + $.isWindow(window) );</script>

</body>
</html>

Demo:

User Contributions

  • Support requests, bug reports, and off-topic comments will be deleted without warning.

  • Please do post corrections or additional examples for jQuery.isWindow() below. We aim to quickly move corrections into the documentation.
  • If you need help, post at the forums or in the #jquery IRC channel.
  • Report bugs on the bug tracker or the jQuery Forum.
  • Discussions about the API specifically should be addressed in the Developing jQuery Core forum.
  • Scipion
    var a={setInterval:2};
    window===a;//false
    but
    $.isWindow(a); //true
  • Bruce King
    it's a crude method man~ ;)