...

View Full Version : Dynamically Expanding Embedded Objects



questionable
12-28-2009, 06:08 PM
Is there a way to get <object>'s to expand depending on content?

I tried to style="overflow: visible;" and this didn't work either. Is there a solution?

Excavator
12-28-2009, 06:37 PM
Hello questionable,

Expanding to fit it's content is <object>'s normal behavior.

Can you show us how you're using it?

questionable
12-28-2009, 07:37 PM
I'm using it with like this:


<object data="resultedinfo.php"></object>

However, it only shows in a box that looks like it's 400px by 300px

Excavator
12-28-2009, 08:01 PM
What size is resultedinfo.php? What styles resultedinfo.php? What styles <object>? What contains <object>?
And, since there is some question as to browser support (http://www.w3schools.com/TAGS/tag_object.asp)for <object>, what browser are you seeing the problem in?

Not to sound rude or anything but this information is needed to figure out a solution to your problem. A little help from you (see #3) (http://www.codingforums.com/postguide.htm) would go a long ways toward finding an answer.

Arbitrator
12-29-2009, 09:51 AM
I'm using it with like this:


<object data="resultedinfo.php"></object>

However, it only shows in a box that looks like it's 400px by 300pxAs far as I'm aware, the object element, like the iframe element, does not resize to fit the content of document types such as HTML and XHTML (which is what I presume the PHP output is). It will resize to fit content with an intrinsic width (i.e., images), but that's about it; otherwise, you get a default width unless you specify one. If I'm not mistaken, the default is 300150 pixels per the CSS spec.

Excavator
12-29-2009, 08:30 PM
So questionable, if the php output is html ... what is the reason for putting it in <object> tags?

questionable
12-29-2009, 09:24 PM
Yes Arbitrator, the output is html. I originally used an iframe but I've been told that the object tag is more versatile. Is there anyway to get either of these to auto resize so the content isn't the default size?

Thanks

Arbitrator
12-30-2009, 03:35 AM
So questionable, if the php output is html ... what is the reason for putting it in <object> tags?If I'm not mistaken, the iframe element is disallowed in HTML 4.01 Strict because the intention was that the object element would replace it.


Yes Arbitrator, the output is html. I originally used an iframe but I've been told that the object tag is more versatile.Given the implementation problems, I'm not so sure about that. It's more versatile than, say, the img element since you can use markup as fallback, but for HTML pages, I'm not so sure.


Is there anyway to get either of these to auto resize so the content isn't the default size?Yes, using the CSS/HTML width and height properties/attributes you can do this.

I assume you misspoke though and meant to ask if there was a way to get the frame to size to the document. As far as I'm aware, there is no way to do this with HTML 4.01. The closest you could get it to parse the document with a server-side language and add the output to your document (on the server side).

HTML 5 will allow this with the seamless attribute on iframe elements, I believe, but I'm not aware if any browser vendor that has implemented it yet. object apparently lacks a new, similar attribute.

_Aerospace_Eng_
12-30-2009, 05:16 AM
Javascript can be used to resize an iframe to its content but it may not be able to do the same using an object tag. I am also questioning the use of using an object element. Why not just use include to put the php file into your page?

questionable
12-30-2009, 04:05 PM
Thanks Aerospace_Eng_!

That solved my problems. <div>'s don't have a src attribute but I was able to use:

(Using jQuery):

url = document.location.href+"?findme="+escape(findthis);
$.get(url, function(data)
{
$("#addToPage").html(data);
});

On Page:

<div id="addToPage"></div>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum