364,083 Members | 5803 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

Problem with iframe (caching...)

Peroli
P: n/a
Peroli
Hi all,
I have an iframe as stated below. When i initiate the function
"open_frm()" everything is working as i expected.

When the document is loaded, i click on a link in the iframe, with
posts some data to the server (to url "myscript.peroli?q=something")
and gets back with results. Everything happens inside the iframe, no
interaction with parent window.

But when i do this 2 or more times, mozilla and IE is giving me a
cached copy. But if i reload the iframe (by right clicking on iframe
and reload) again after initiating the function it gets the right stuff
from the server.

I even accessed the script("myscript.peroli") in a new window, it
gave me the right result. Its just that when its loaded into iframe, it
gives cached copy.

I tried setting cache-control pragmas and meta directives and
forced the browser not to cache the data, but they seem to ignore them
particularly when inside IFRAME.

Is this a bug or am i doing something wrong? If you know of any
workarounds... let me know.

[html]
<iframe id="rGen" name="rGen" width="95%" height="400"
style="display:none" frameborder="0">Your Browser doesn't support
Iframes</iframe>
[/html]
//---------------------------------------------------
[script]
function open_frm() {
if(typeof frames['rGen'] == 'undefined') return;
var rGen = document.getElementById('rGen');
rGen.style.display = '';
frames['rGen'].location.href="myscript.peroli";
}
[/script]
//----------------------------------------------------

regards,
Peroli Sivaprakasam

Sep 19 '05 #1
Share this Question
Share on Google+
5 Replies


Zoe Brown
P: n/a
Zoe Brown
add a random parameter to the request of the page

bla.href = "mypage.html?randomrequest=" + random number


"Peroli" <peroli@gmail.com> wrote in message
news:1127137493.623141.79250@g44g2000cwa.googlegro ups.com...[color=blue]
> Hi all,
> I have an iframe as stated below. When i initiate the function
> "open_frm()" everything is working as i expected.
>
> When the document is loaded, i click on a link in the iframe, with
> posts some data to the server (to url "myscript.peroli?q=something")
> and gets back with results. Everything happens inside the iframe, no
> interaction with parent window.
>
> But when i do this 2 or more times, mozilla and IE is giving me a
> cached copy. But if i reload the iframe (by right clicking on iframe
> and reload) again after initiating the function it gets the right stuff
> from the server.
>
> I even accessed the script("myscript.peroli") in a new window, it
> gave me the right result. Its just that when its loaded into iframe, it
> gives cached copy.
>
> I tried setting cache-control pragmas and meta directives and
> forced the browser not to cache the data, but they seem to ignore them
> particularly when inside IFRAME.
>
> Is this a bug or am i doing something wrong? If you know of any
> workarounds... let me know.
>
> [html]
> <iframe id="rGen" name="rGen" width="95%" height="400"
> style="display:none" frameborder="0">Your Browser doesn't support
> Iframes</iframe>
> [/html]
> //---------------------------------------------------
> [script]
> function open_frm() {
> if(typeof frames['rGen'] == 'undefined') return;
> var rGen = document.getElementById('rGen');
> rGen.style.display = '';
> frames['rGen'].location.href="myscript.peroli";
> }
> [/script]
> //----------------------------------------------------
>
> regards,
> Peroli Sivaprakasam
>[/color]


Sep 19 '05 #2

Christopher Benson-Manica
P: n/a
Christopher Benson-Manica
Zoe Brown <zoenaomibrown@n-o-s-p-a-a-mtesco.net> wrote:
[color=blue]
> add a random parameter to the request of the page[/color]
[color=blue]
> bla.href = "mypage.html?randomrequest=" + random number[/color]

I personally suggest

bla.href="mypage.html?junk="+(new Date()).valueOf());

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Sep 19 '05 #3

Zoe Brown
P: n/a
Zoe Brown

"Christopher Benson-Manica" <ataru@nospam.cyberspace.org> wrote in message
news:dgmpp1$6k5$2@chessie.cirr.com...[color=blue]
> Zoe Brown <zoenaomibrown@n-o-s-p-a-a-mtesco.net> wrote:
>[color=green]
>> add a random parameter to the request of the page[/color]
>[color=green]
>> bla.href = "mypage.html?randomrequest=" + random number[/color]
>
> I personally suggest
>
> bla.href="mypage.html?junk="+(new Date()).valueOf());[/color]

that would do it !!


Sep 19 '05 #4

km0ti0n
P: n/a
km0ti0n
Hi Peroli

You need to pass a unique parama each time you want to "force" the page
to readload.

I have made a example and explained in greater depth here :
http://km0ti0n.blunted.co.uk/viewng....27725749843750

hope it helps



Peroli wrote:[color=blue]
> Hi all,
> I have an iframe as stated below. When i initiate the function
> "open_frm()" everything is working as i expected.
>
> When the document is loaded, i click on a link in the iframe, with
> posts some data to the server (to url "myscript.peroli?q=something")
> and gets back with results. Everything happens inside the iframe, no
> interaction with parent window.
>
> But when i do this 2 or more times, mozilla and IE is giving me a
> cached copy. But if i reload the iframe (by right clicking on iframe
> and reload) again after initiating the function it gets the right stuff
> from the server.
>
> I even accessed the script("myscript.peroli") in a new window, it
> gave me the right result. Its just that when its loaded into iframe, it
> gives cached copy.
>
> I tried setting cache-control pragmas and meta directives and
> forced the browser not to cache the data, but they seem to ignore them
> particularly when inside IFRAME.
>
> Is this a bug or am i doing something wrong? If you know of any
> workarounds... let me know.
>
> [html]
> <iframe id="rGen" name="rGen" width="95%" height="400"
> style="display:none" frameborder="0">Your Browser doesn't support
> Iframes</iframe>
> [/html]
> //---------------------------------------------------
> [script]
> function open_frm() {
> if(typeof frames['rGen'] == 'undefined') return;
> var rGen = document.getElementById('rGen');
> rGen.style.display = '';
> frames['rGen'].location.href="myscript.peroli";
> }
> [/script]
> //----------------------------------------------------
>
> regards,
> Peroli Sivaprakasam[/color]

Sep 19 '05 #5

Peroli
P: n/a
Peroli
Hi Km0ti0n and everyone else,
km0ti0n wrote:[color=blue]
> Hi Peroli
>
> You need to pass a unique parama each time you want to "force" the page
> to readload.
>
> I have made a example and explained in greater depth here :
> http://km0ti0n.blunted.co.uk/viewng....27725749843750
>
> hope it helps
>[/color]

Thanks a lot. It worked. I feel so silly that i didn't know this.

-- Peroli Sivaprakasam

Sep 20 '05 #6

Post your reply

Help answer this question



Didn't find the answer to your JavaScript / Ajax / DHTML question?

You can also browse similar questions: JavaScript / Ajax / DHTML