Forum Moderators: open

Message Too Old, No Replies

accessing IFRAME content properties (height) when it's on another server

         

Haarlem Steve

5:38 pm on Jan 12, 2005 (gmt 0)

10+ Year Member



I know when accessing the content of an IFRAME, you cannot read properties if the content is from a different server to the calling document.

However, I have the following situation:

I have some navigation code containing an iframe which loads up banners from a 3rd party source into an iframe. These banners can be of any size, therefore i need the iframe to dynamicaly resize based on the ad size.
I cannot read the ad size because i do not have access to the properties of the iframe content because it is on another server.
Is there any other way of obtaining the height of the content of the iframe?
tks

tedster

3:49 am on Jan 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you can't get some information from the source- a maximum possible height for the banner or something like tha - then you need to do some scripting.

Client-side javascript could get messy, and would also be a problem for a certain percentage of your visitors.

If these banners are images (I assume so) then each file format begins with a few bytes that give its dimensions. Some server side processing might be able to pull that information and give it to you dynamically for the iframe dimensions.

I've never done this, but I've heard that it's possible. Still, it is a bit complicated.

My apologies for not haveing anything more definitive to offer.

sinixstar

6:11 am on Jan 13, 2005 (gmt 0)

10+ Year Member



tell the people serving the banners that they need to pick a size and stick with it. lol
most companies that serve ads these days do that as it is. Or, make the area that your ads are being called from a specific color - and tell them when they serve these ads - the background needs to match the color. Make the iFrame as big as the biggest image, and then even if you get a smaller one - it will match.

kind of a crappy way of doin it - but it should work.
also - depending on how you do it on the client-side - the script to resize the iframe wouldn't nessicarily be that bad. I could see how a client-side script could get ugly though. So be careful if you do decide to go that route.

Haarlem Steve

8:56 am on Jan 13, 2005 (gmt 0)

10+ Year Member



thanks for the replies:

2 points i didn't put in the original message (for fear of making it too confusing on first read ...):

1: ads are a mixture of images and flash and will be any size and shape (yes, shape: they call them flap ads here)

2: making the iframe a big size will not work: i have already set the transparancy on (works for ie and firefox), the problem is that the ads come out over content, and where there is a shaped ad with transparancy the user needs to be able to read the content behind and click on any links there .....