By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,720 Members | 1,045 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,720 IT Pros & Developers. It's quick & easy.

DOM access to <OBJECT type="text/html" data="..." /> or <iframe>

P: 1
Hello,

I use an object element to replace the iframe element in ie, like this:

[HTML]<object
id="x_obj"
data="http://.../"
type="text/html">

<iframe name="x_if" id="x_if" src="http://.../">
</iframe>

Alternative text (if object and/or iframe are not supported)

</object>
[/HTML]
With an <iframe> to support gecko browsers.

I want to retrieve the total height of the page loaded inside the object/iframe element.

With ie, this script works:

alert(document.getElementById("x_obj").object.body .scrollHeight);


And in gecko browsers (FF), the script should look like this:

alert(document.getElementById("x_if").contentDocum ent.height);


This script written for firefox doesn't work well as it gives a result of "0".

When I delete the object element from my script and just leave the iframe element, it works well.

Could anyone help me understand this strange behaviour ?

Thank you very much.
Jun 29 '06 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
The iframe should not appear inside object tags. Gecko browsers do support the object tag.
Apr 28 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.