I'm trying to get the height of an <iframe>d document. My first instincts were:
$('iframe').document.height();
or
$('iframe').contentWindow.document.height();
Those don't work, and I'm not having much luck searching. I would appreciate any help!
From stackoverflow
-
$("iframe",top.document).contents().height(); alert("iframe height=" + $("iframe",top.document).height());
Bungle : Thanks Chris, but that didn't work for me (at least in Firefox). I get this exception: [Exception... "Could not convert JavaScript argument arg 0" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js :: anonymous :: line 12" data: no] If I assign that to a variable as such: var height = $("iframe", top.document).contents().height(); it remains undefined after the assignment and causes the above exception.Bungle : Also, this: $("iframe", top.document).height(); appears to just give me the height of the
0 comments:
Post a Comment