PDA

View Full Version : Keep Firefox from caching iframe



Peter Johnson
09-21-2011, 06:15 PM
OK - realized I made this WAY more complicated than it needed to be.

Here's the issue - how to keep firefox from caching what's in the iframe after it runs a resizing script - make it realize that a link has been clicked within the iframe, and then resize for that.

main.htm has the iframe, which loads frame1.htm. frame1.htm has a link to frame2.htm which is a different size.

I know there's a DD script - but I wondered if anything could be added to this particular script, to make it work in FF.

This works in IE, but not FF - thanks!

main.htm

<html>
<head>
<meta name="robots" content="noindex, nofollow">
</head>
<body>

<div id="saysomething">hello world</div>

<div><iframe id='library' src='frame1.htm' frameborder='1' height="300"></iframe></div>

</body>
</html>

frame1.htm

<html>
<head>
<meta name="robots" content="noindex, nofollow">
</head>

<body onload="resizeIframe()">

<script type="text/javascript">
function resizeIframe() {
var howtall = document.body.scrollHeight;
parent.document.getElementById('library').style.height=howtall;
parent.document.getElementById('saysomething').innerHTML=howtall;
}
</script>

<p>content frame1.htm - it's longer</p><p>content</p><p>content</p><p>content</p>
<p> <a href="frame2.htm">go to frame2</a> <p>content</p>
<p>content frame1.htm </p><p>content frame1.htm </p><p>content frame1.htm </p><p>content frame1.htm </p><p>content frame1.htm </p><p>content frame1.htm </p><p>content frame1.htm </p><p>content frame1.htm </p><p>content frame1.htm </p><p>content frame1.htm </p>
<p>content frame1.htm </p><p>content frame1.htm </p><p>content frame1.htm </p><p>content frame1.htm </p><p>content frame1.htm </p><p>content frame1.htm </p><p>content frame1.htm </p><p>content frame1.htm </p><p>content frame1.htm </p><p>content frame1.htm </p>
</body>
</html>

frame2.htm

<html>
<head>
<meta name="robots" content="noindex, nofollow">
</head>

<body onload="resizeIframe()">

<script type="text/javascript">
function resizeIframe() {
var howtall = document.body.scrollHeight;
parent.document.getElementById('library').style.height=howtall;
parent.document.getElementById('saysomething').innerHTML=howtall;
}
</script>

<p>content frame2.htm - its shorter</p><p>content frame2.htm</p><p>content frame2.htm</p><p>content frame2.htm</p>
<p> <a href="frame1.htm">go to frame1</a> <p>conten frame2.htmt</p><p>content frame2.htm</p>

</body>
</html>

Butterfly
09-21-2011, 06:18 PM
It seems that Firefox does some aggressive caching. I have some issues myself with a client's site. I'm not sure you can bypass it, but I'll watch this thread as someone might come up with an useful solution.

Peter Johnson
09-23-2011, 01:44 PM
I tried
I have tried math.random - didn't work with FF
I also tried pragma no-cache in the framed pages - Didn't work with Firefox - it still just uses the height of the first page it loaded