...

View Full Version : how can i fix window.resizeTo problem in firefox?



darp
01-20-2005, 11:21 AM
I need to use the following code in an iframe in order to resize it when it opens.

<SCRIPT LANGUAGE="javascript">
<!--
width=700;
height=180;
window.resizeTo(width,height);
//-->
</SCRIPT>

The problem is that it works in IE but does not work in firefox.
Can anyone think of a way of making it work in firefox?

Thanks.

glenngv
01-20-2005, 02:32 PM
Is there any reason why you're not putting the width and height in the <iframe> tag itself?

joh6nn
01-20-2005, 04:40 PM
Firefox allows its users to disable the resizing of windows. check to make sure that the user preferences are appropriately set.

darp
01-20-2005, 09:22 PM
glenngv: i have to do it like that because the content changes dynamically all the time.

joh6nn: yes, i am sure it is enabled. it just does not work when its in an iframe.

joh6nn
01-21-2005, 12:52 AM
wait...

so, let's say you've got a window with a.html loaded into it, and a.html has an iframe containing b.html. are you saying that b.html's resizeTo javascript doesn't change the size of the iframe, or it doesn't change the window that contains a.html?

if you're not asking about one of those two things, i don't know what you're asking.

glenngv
01-21-2005, 02:39 AM
are you saying that b.html's resizeTo javascript doesn't change the size of the iframe, or it doesn't change the window that contains a.html?

I think it's the former. I've tried it in firefox and the iframe's size doesn't change the way IE does.

The solution I can think of is to have this function in the page that contains the iframe.


function resizeIframe(w, h){
document.getElementById("iframeID").contentWindow.resizeTo(w, h);
}

Then in each of the pages that will go to the iframe, call the function like this:


if (parent.resizeIframe){
parent.resizeIframe(700, 180);
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum