Log in

View Full Version : IE iframe handling



Burgin
10-01-2011, 02:02 PM
I'm using an iframe (id="screen") to deliver various pieces of content and I have an image link that uses target="screen" to return the iframe to the original menu.

It works fine in Chrome & Firefox but not in IE8 or 9.

Any clues as to why and how to combat it will be greatly appreciated, you can view the page here...

http://www.13ill.com/iphone/

jscheuer1
10-01-2011, 04:33 PM
The target attribute is for the name attribute of the iframe, not the id. Or at least that was how it was originally. Or maybe that was only ever in IE.

In any case, those other browsers will recognize targeting the iframe by its name. And if you still need the id - say for styling the iframe from a stylesheet, you can use both.

To make a long story short, add the highlighted:


<iframe id="screen" name="screen" src="apps.htm" width="211px" height="297px" scrolling="no"></iframe>

Ah, I see you already did, and it's working in IE. I'm marking this thread resolved.

But let us know if you're still having problems.

Burgin
10-01-2011, 05:07 PM
Yes I did try adding name="screen" before I posted and it still didn't work in IE 8 but didn't try it in IE9

Thanks

jscheuer1
10-01-2011, 05:56 PM
You may just need to refresh the page and/or clear the browser's cache.

Works here in IE 9. And sort of in IE 8. The transition is very unsightly, but works. Looks like you need to hide it while it's updating/loading. At least for that browser. Something like add to the click event .css({display: 'none'}), .css({visibility: 'hidden'}), or a .hide() for the iframe. Then have the iframe's onload event do the reverse.

That or if possible get rid of whatever is causing the distortion of the size of the iframe while the new content is loading. Do you have some sort of auto resizing code for it? If so, that might be the culprit.

Anyways, as I say, it is loading in those browsers, looks good in IE 9, choppy transition in IE 8. The transition back to the original screen is fine. Clicking the JamCam or Radio Stations! icons, for instance causes the distortion as things load. Perhaps preloading images might help? And until the initial screen is cached, it loads at the bottom momentarily then slides in from the upper left on 1st page load.