admin管理员组

文章数量:1410674

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 acmodate 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:

.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.

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 acmodate 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/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.

Share Improve this question edited Jan 27, 2009 at 19:18 mmcdole 93k61 gold badges188 silver badges224 bronze badges asked Jan 21, 2009 at 17:30 AntonioCSAntonioCS 8,51618 gold badges67 silver badges95 bronze badges 2
  • Example page URL to demonstrate what you mean, please. Resizing should not in general reload any content - unless you're including an incredibly old and shonky Netscape 4 bugfix script, which I should hope you're not in this day and age. – bobince Commented Jan 21, 2009 at 17:44
  • Here is the test page -> antoniocs/iframe/index_.html – AntonioCS Commented Jan 22, 2009 at 12:11
Add a ment  | 

4 Answers 4

Reset to default 4 +200

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).

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.

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.

Here is a page where you can see the code -> http://antoniocs/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.

本文标签: javascriptHow do I prevent a swf from refreshing when an iframe is resizedStack Overflow