How to resize html object element to the size of the content?

Below you can see the code I have so far in PHP which creates the code I want to display as an HTML object. However, I have no idea how to resize this object to the size of the content. I have found hacks for iframes to do this but I have not been able to find anything for the object element. I suspect it's out there but "object" is such a common word it's hard to get relevant search results.

I've attached the code I have so far. It's PHP but it should be obvious what HTML it creates.

Ideally I would like to do the resizing with jQuery but as long as I get the idea of how to do it with JavaScript I can always modify the JS to be jQuery code. Of course if this could be done without any active code like JS that would be outstanding but I am assuming that JS will be needed.

Thanks heaps!

<?php
$source = 'http://www.domain.com/searchnew.aspx';
$backup_content = '<p>Search New</p>';

$type = 'type="text/html"';
$type_ie = 'classid="clsid:25336920-03F9-11CF-8FD0-00AA00686F13"';

$out=<<<EOT
  <!--[if IE]>
    <object $type_ie data="$source">
      $backup_content
    </object>
  <![endif]-->
  <!--[if !IE]> <-->
    <object $type data="$source">
      $backup_content
    </object>
  <!--> <![endif]-->
EOT;
echo $out;
?>

Open in new window

LVL 1
RegProctorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RegProctorAuthor Commented:
No takers?

Here's the code in pure HTML - no PHP.

<!--[if IE]>
  <object classid="clsid:25336920-03F9-11CF-8FD0-00AA00686F13" data="http://www.domain.com/">
    <p>domain.com</p>
  </object>
<![endif]-->
<!--[if !IE]> <-->
  <object type="text/html" data="http://www.domain.com/">
    <p>domain.com</p>
  </object>
<!--> <![endif]-->

Open in new window

David Johnson, CD, MVPOwnerCommented:
an html object has no predetermined size that you can query.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RegProctorAuthor Commented:
Sad but true. Thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.