views:

1121

answers:

4

I am resizing an iframe, and when I do that in Firefox, the content gets refreshed.

I have a swf that extends, and in Firefox when the iframe extends to accommodate the swf, the swf appears in its normal position.

In IE this doesn't happen.

Anyone know how to prevent the refresh from happening in Firefox?

Thanks


Edit:

Ok I think the page is not being refreshed just the swf please check this out at:

http://antoniocs.org/iframe/index_.html

You can see that when the re-dimensioning takes place there is a quick "flash", in Firefox 3 and the swf returns to its initial state (not expanded), this does not happen in IE.

The code is all client side so you can view it all if you look at the source of the pages.

A: 

There is no onresize code.

It's simple! I have an iframe with width 300 and height 250 and when I change them to 500 and 400 firefox refreshes the content and I want to prevent that.

AntonioCS
define "refresh" - if you resize anything any given browser is going to repaint that, and afaik there's no way to stop that (and why would you?) but if you're saying FF literally refreshes, i.e. re-requests the content, something may be up
annakata
Indeed. It should not refresh and does not in my test case. Example code that demonstrates the problem is needed.
bobince
A: 

Here is a page where you can see the code -> http://antoniocs.org/iframe/index_.html

The code to re size the iframe runs after 3 seconds and you can see the the swf, if it was extended, appears in it's initial (not extended) form.

To extend the swf just hover the mouse over it.

In ie there is no refresh in the iframe.

AntonioCS
+3  A: 

Antonio, I'm afraid that the problem is in Firefox it self. When Gecko detects a change to the width of an iFrame, it repaints the page and causes that "refresh." There's no way that I know of to change this behavior, short of using a different technique.

I confirmed that the problem exists in other Gecko-based browsers as well (specifically Camino and Flock). I was not able to duplicate it in WebKit-based browsers (Chrome and Safari).

Robert S.
+3  A: 

It seems to be that either setting position: absolute; or .cssText will refresh the frame.

The solution is to add style="position: absolute;" to your <iframe> and set your css like this:

this.mrec_div_idObj.style.left = ((offsetLeftIframe) - (dimX - disX)) + "px";
this.mrec_div_idObj.style.top = (offsetTopDiv - disY) + "px";
this.mrec_div_idObj.style.zIndex = 99999999;
this.mrec_div_idObj.style.margin = 0;
this.mrec_div_idObj.style.padding = 0;

I've tested this and it works in Firefox 3.

Greg