jQuery.isWindow(obj) (alias $.isWindow) returns true when obj is a browser window — the current page window or an iframe’s contentWindow (added in jQuery 1.4.3).
Syntax
Start with these common calls. Keep them short and readable.
Learn jQuery.isWindow(): detect browser window objects vs plain objects and DOM nodes, official replacement after deprecation, examples, pitfalls, and FAQs.
Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.
Parameters
Parameter
Description
Step 1
Start with a value that might be a window (context arg, iframe handle, etc.).
Step 2
Call $.isWindow(obj) — or the official one-liner replacement.
Step 3
If true, treat it as a window (read document, size, location, …).
Return Value
Return Value
Description
Boolean
Often true or false depending on the match or state.
jQuery Examples
Example 1 — Detect the Global window
The current page browsing context passes the test.
Identity.obj === obj.window is true only for Window objects.
Parity. Matches $.isWindow on jQuery 3.x for normal cases.
Frequently Asked Questions
jQuery.isWindow(obj) returns true when obj is a browser window object — the global window or an iframe's contentWindow. It returns false for plain objects, DOM elements, document, null, and primitives.
Yes. It was deprecated in jQuery 3.3 and removed in jQuery 4.0. jQuery recommends reimplementing it as: function isWindow(obj) { return obj != null && obj === obj.window; }
jQuery uses window detection internally when deciding whether a context is the global browsing context or an iframe — for example when resolving document roots and comparing execution contexts.
isPlainObject returns true for simple {} maps. isWindow returns true only for window objects. $.isPlainObject(window) is false, and $.isWindow({}) is false.
No. typeof window is "object", but so are arrays and DOM nodes. isWindow uses the obj === obj.window identity check that specifically identifies window objects.
Yes, when you can access the iframe's contentWindow (same-origin). Cross-origin iframes block access and throw a security error — catch that before testing.