• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 326
  • Last Modified:

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

0
RegProctor
Asked:
RegProctor
  • 2
1 Solution
 
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

0
 
David Johnson, CD, MVPOwnerCommented:
an html object has no predetermined size that you can query.
0
 
RegProctorAuthor Commented:
Sad but true. Thanks.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now