aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/window/frameelement/index.html
blob: 77db39f5a385204b744df46b14c69d6ce8bf14b8 (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
56
57
58
59
60
61
62
63
64
65
66
---
title: window.frameElement
slug: Web/API/Window/frameElement
tags:
  - API
  - DOM
  - Gecko
  - HTML DOM
  - Window
translation_of: Web/API/Window/frameElement
---
<div>{{ ApiRef }}</div>

<p>{{HTMLElement("iframe")}}{{HTMLElement("object")}} のような)ウィンドウが埋め込まれた要素を返します。要素がトップレベルであるか異なるスクリプト生成元をもつ文書に埋め込まれるかのいずれかの場合は、 <code>null</code> を返します。</p>

<h2 id="構文">構文</h2>

<pre class="syntaxbox"><var>frameEl</var> = window.frameElement;
</pre>

<ul>
 <li><code>frameEl</code> は、ウィンドウが埋め込まれた要素です。ウィンドウが別の文書に埋め込まれていない場合、または埋め込まれている文書が異なる生成元を持つ(例えば異なるドメインから設置されている)場合、これは <code>null</code> になります。</li>
</ul>

<div class="note">
<p>このプロパティの名前にもかかわらず、これは{{HTMLElement("object")}}{{HTMLElement("iframe")}}、または <a href="https://developer.mozilla.org/ja/docs/Web/HTML/Element/embed">&lt;embed&gt;</a>を含むすべての埋め込みポイント内に埋め込まれた文書の役に立ちます。</p>
</div>

<h2 id="例"></h2>

<pre class="brush:js">var frameEl = window.frameElement;
// 埋め込みの場合、要素の URL が 'http://mozilla.org/' に変わります。
if (frameEl) {
  frameEl.src = 'http://mozilla.org/';
}
</pre>

<h2 id="仕様">仕様</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">仕様</th>
   <th scope="col">状態</th>
   <th scope="col">コメント</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{ SpecName('HTML WHATWG', '#dom-frameelement', 'Window.frameElement') }}</td>
   <td>{{ Spec2('WebRTC 1.0') }}</td>
   <td>初期の仕様</td>
  </tr>
 </tbody>
</table>

<h2 id="ブラウザー互換性">ブラウザー互換性</h2>

<p>{{Compat("api.Window.frameElement")}}</p>

<h2 id="関連項目">関連項目</h2>

<ul>
 <li>{{domxref("window.frames")}} は、現在のウィンドウの直接のサブフレームを一覧する、配列のようなオブジェクトを返します。</li>
 <li>{{domxref("window.parent")}} は、子ウィンドウの<code>frameElement</code>を含むウィンドウである、親ウィンドウを返します。</li>
</ul>