Solved

Rendering <object> elements

Posted on 2006-11-21
3
233 Views
Last Modified: 2010-04-09
I have a webpage with several <object> elements -- references to other .htm web pages that I want to embed in my primary page. However, when they render on my browser, they always render at the same size -- it looks like 200x200. I could adjust their size by adding height and width attributes, but what I really want is for the browser to render these objects to a reasonable size given the size of the browser window. I thought I could do something like this:

<div style="border: 1px solid black;">
     <object data="mydata.htm" id="myobj">
</div>

Here, the <div> element expands to a good size, but rather than occupying the entire box enclosed by the <div> element, the <object> is still the same 200x200. Is there any way to get the browser to dynamically choose an appropriate size for the <object> element -- particularly, is there any way to do it without Javascript? (I already have Javascript code that does what I want to do, but I'm having cross-browser compatibitility problems, especially with Opera and the Mac browsers.)

Thanks,

Jay
0
Comment
Question by:tjgquicken
3 Comments
 
LVL 12

Expert Comment

by:jessegivy
Comment Utility
What size do you want the objects to be?
0
 
LVL 13

Accepted Solution

by:
jmundsack earned 200 total points
Comment Utility
You could use an IFRAME with its width and height both set to 100%, then place it inside a DIV and configure the widths and heights of all the DIVs on your page as you like (perhaps with widths and heights relative to page dimensions?).

<div style="border: 1px solid black; width: 500px; height: 400px;">
<iframe src="http://www.experts-exchange.com/" id="myobj" style="width: 100%; height: 100%;">
</div>

Or...

<div style="border: 1px solid black; width: 80%; height: 50%;">
<iframe src="http://www.experts-exchange.com/" id="myobj" style="width: 100%; height: 100%;">
</div>

It's not really clear what you mean by "get the browser to dynamically choose an appropriate size"--if you mean you want it to interpret the overall dimensions of the HTML contained in the embedded page, then I think there's no way to escape Javascript.

0
 

Author Comment

by:tjgquicken
Comment Utility
Silly me... <object id="myobj" src="mysrc.htm" width="100%" height="100%">
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now