回答編集履歴

1

HTMLIframeElement#contentWindow

2017/07/18 02:14

投稿

think49
think49

スコア18166

test CHANGED
@@ -1,3 +1,7 @@
1
+ ### iframe要素の内容
2
+
3
+
4
+
1
5
  > ```HTML
2
6
 
3
7
  > <iframe src="html:*****.com" id="parent">
@@ -32,4 +36,44 @@
32
36
 
33
37
 
34
38
 
39
+ ### jQuery("iframe html body")
40
+
41
+
42
+
43
+ あるいは、iframe要素のリンク先を表す疑似コードなのでしょうか。
44
+
45
+ しかし、それなら、$("#parent html body").height(); が動くはずがないと思うのですが…(未検証)。
46
+
47
+
48
+
49
+ **(2017/07/18 11:05追記)**
50
+
51
+ jQuery 3.2.1 + Google Chrome + 59.0.3071.115 で検証しましたが、やはり期待通りに動作しませんでした。
52
+
53
+
54
+
55
+ - [iframe要素のリンク先 - JSFiddle](https://jsfiddle.net/hm0vwk3u/2/)
56
+
57
+
58
+
59
+ ### HTMLIframeElement#contentWindow
60
+
61
+
62
+
63
+ - [HTMLIFrameElement - Web API インターフェイス | MDN](https://developer.mozilla.org/ja/docs/Web/API/HTMLIFrameElement)
64
+
65
+ - [iframe要素のリンク先の高さを得る - JSFiddle](https://jsfiddle.net/hm0vwk3u/3/)
66
+
67
+
68
+
69
+ ```JavaScript
70
+
71
+ console.log(document.getElementById('parent').contentWindow.innerHeight);
72
+
73
+ console.log(document.getElementById('parent').contentDocument.body.clientHeight);
74
+
75
+ ```
76
+
77
+
78
+
35
79
  Re: odmdom さん