PDA

View Full Version : firefox wont refresh an iframe



Littlened
22 Nov 2006, 02:52 PM
I have a page which has 2 iframes on it, when the user clicks results in iframe1, iframe2 appears which lets the user edit the information. When the user saves the information the iframe calls a function on the main page which is supposed to tell the results (iframe1) to reload, however in firefox it doesnt reload. I'm 100% sure this worked fine earlier, but now it's suddenly stopped. The reload seems to work perfectly in IE7.

This is the javascript I have. The results iframe is the one I want to reload. If I change "location.reload(true)" to "src = 'http://www.google.co.uk'" the script displays Google within the iframe, so I know all the other code is working properly.

function makeinvisible()
{
document.getElementById('overlay_div').style.display='none';
document.getElementById('results').location.reload(true);
}

my iframe is this

<iframe width="570" height="400" frameborder="0" id="results" name="results" src="my_hotels_manage.php" />

My main problem is that one the content of the iframe has been initially loaded, its URL changes dynamically upon user input, which rules out using code such as src = src, which would just reload the initiall page, which is not what I want. For example, the main page has a little form on it, on submitting the form the POST data is sent to the content of the iframe, which displays certain results depending on the user input. Now, if I reload the initial page, the users selected results are lost and everything is displayed.

I'm inclined to think that the page is being reloaded from client side cache, but I've tried adding a line to the page like "<META HTTP-EQUIV="No_storing" CONTENT="no-cache" />" to try and prevent the browser from storing the page. I've even tried location.reload(), location.reload(1) and much much more.

Does anyone have any idea what so ever why this wouldnt work?

If I can't find a solution then I'm going to have to make this part of the site only accessible via IE (which isnt a big deal as its not a public site), or make it so that the form sends its POST data to the main page, which then generates the SRC of the iframe, so then I would be able to use SRC = SRC to refresh the content of the frame. The only problem with doing this is I'd have to create the code to get the main page to retreive the POST data, then send the data via the URL to the iframe page, then the code for the iframe page to retrieve the POST data again, which will be a right pain.

Thanks in advance for any help.

Littlened
22 Nov 2006, 03:19 PM
sorry, solved it.

I used;

window.results.location.reload(true);