iframe

iframeの親のwindowを見る方法

parent == 親のwindow

jQueryでcontentWindowを参照する

$('iframe')[0].contentWindow //window
$('iframe').contents()[0] //document
$('iframe').contents().find('body')[0] //body
$('iframe').contents().find('html')[0] //html

http://code.nanigac.com/forum/view/381

同一ドメインであることが前提です。


//iframe 内の window オブジェクトを参照する
$('iframe')[0].contentWindow


//iframe 内の document オブジェクトを参照する
$('iframe')[0].contents()[0]


//iframe 内の html 要素を参照する
$('iframe').contents().find('html')[0]


//iframe 内の head 要素を参照する
$('iframe').contents().find('head')[0]


//iframe 内の body 要素を参照する
$('iframe').contents().find('body')[0]


//iframe 内の div 要素を参照する
$('iframe').contents().find('div')[0]

iframe 関連処理まとめ - Cyokodog :: Diary