开发者

Find the window of an element inside an iframe

开发者 https://www.devze.com 2023-01-16 13:41 出处:网络
Is there a cross browser method of returning the window object of an element whether it be in an iframe.

Is there a cross browser method of returning the window object of an element whether it be in an iframe.

Thi开发者_开发技巧s does the job for me but I don't know how well supported it is or if jQuery has a solution.

var edoc = elem.ownerDocument.defaultView || elem.document.parentWindow;


Your code should work in all major browsers. To clarify it - the first part is for non-IE browsers while the second targets IE. To the best of my knowledge jQuery does not provide a shortcut for that code.


Use frame.contentWindow

var win = iframeElement.contentWindow;
0

精彩评论

暂无评论...
验证码 换一张
取 消