Solved

Rendering <object> elements

Posted on 2006-11-21
3
234 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
ID: 17993916
What size do you want the objects to be?
0
 
LVL 13

Accepted Solution

by:
jmundsack earned 200 total points
ID: 17994907
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
ID: 18009273
Silly me... <object id="myobj" src="mysrc.htm" width="100%" height="100%">
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The Google Maps API offers various ways to draw dynamic and static maps.  Using a combination of PHP and JavaScript, you can draw active JavaScript maps that allow pan-and-zoom in the client browser window.  You can also draw "static" …
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

947 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

23 Experts available now in Live!

Get 1:1 Help Now