blob: d499281395482b0db93f326fd4cd4055ca2fc8dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
---
title: Window.top
slug: Web/API/Window/top
tags:
- API
- HTML DOM
- Property
- Reference
- Window
translation_of: Web/API/Window/top
---
<div>{{APIRef}}</div>
<p>Returns a reference to the topmost window in the window hierarchy.</p>
<h2 id="Syntax">Syntax</h2>
<pre class="syntaxbox">var <var>topWindow</var> = window.top;
</pre>
<h2 id="Notes">Notes</h2>
<p>Where the {{domxref("window.parent")}} property returns the immediate parent of the current window, <code>window.top</code> returns the topmost window in the hierarchy of window objects.</p>
<p>This property is especially useful when you are dealing with a window that is in a subframe of a parent or parents, and you want to get to the top-level frameset.</p>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('HTML WHATWG', 'browsers.html#dom-top', 'window.top')}}</td>
<td>{{Spec2('HTML WHATWG')}}</td>
<td> </td>
</tr>
<tr>
<td>{{SpecName('HTML5 W3C', 'browsers.html#dom-top', 'window.top')}}</td>
<td>{{Spec2('HTML5 W3C')}}</td>
<td>Initial definition</td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{Compat("api.Window.top")}}</p>
|