Connecting Tech Pros Worldwide Forums | Help | Site Map

Reload a html file in an IFrame

Chen Zhigao
Guest
 
Posts: n/a
#1: Dec 6 '05
My main html page contains an IFrame in which another html page is
shown. The main page can trigger my CGI program to re-generate the
IFrame html page with quite some data from a database. However, the
content shown in the IFrame does not refreshed sometimes unless I click
the browser refresh button.

I even use

parent.navigate('/cgi-bin/mycgi?inputname=inputvalue')
window.location.reload(true)

in the IFrame page to force refreshing. But it seems only main page is
up to date whereas the IFrame page isn't.

How shall I accomplish this? Any advice is appreciated.


Evertjan.
Guest
 
Posts: n/a
#2: Dec 6 '05

re: Reload a html file in an IFrame


Chen Zhigao wrote on 06 dec 2005 in comp.lang.javascript:
[color=blue]
> My main html page contains an IFrame in which another html page is
> shown. The main page can trigger my CGI program to re-generate the
> IFrame html page with quite some data from a database. However, the
> content shown in the IFrame does not refreshed sometimes unless I click
> the browser refresh button.
>
> I even use
>
> parent.navigate('/cgi-bin/mycgi?inputname=inputvalue')
> window.location.reload(true)
>
> in the IFrame page to force refreshing. But it seems only main page is
> up to date whereas the IFrame page isn't.
>
> How shall I accomplish this? Any advice is appreciated.[/color]


Make the url different each reload, something like:

var dummy=new Date()
myIfame.location.href='/cgi-bin/mycgi?inputname=inputvalue&dummy='+dummy

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Chen Zhigao
Guest
 
Posts: n/a
#3: Dec 6 '05

re: Reload a html file in an IFrame


Thanks for your prompt reply. The URL of
'/cgi-bin/mycgi?inputname=inputvalue' is for the main page, and the
"inputvalue" actually varies each time the CGI is invoked. But the URL
of the regenerated IFrame page does not change as I use the same file
name. Any other thought?

Evertjan.
Guest
 
Posts: n/a
#4: Dec 6 '05

re: Reload a html file in an IFrame


Chen Zhigao wrote on 06 dec 2005 in comp.lang.javascript:
[color=blue]
> Thanks for your prompt reply. The URL of
> '/cgi-bin/mycgi?inputname=inputvalue' is for the main page, and the
> "inputvalue" actually varies each time the CGI is invoked. But the URL
> of the regenerated IFrame page does not change as I use the same file
> name. Any other thought?
>[/color]

No, please try my example on the pagename [you did not mention]:

'/zzz/mypageIframe.html?dummyvalue='+aChangingVariable

where aChangingVariable can contain a random value or a time value

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Dr John Stockton
Guest
 
Posts: n/a
#5: Dec 7 '05

re: Reload a html file in an IFrame


JRS: In article <Xns972478AF4E461eejj99@194.109.133.242>, dated Tue, 6
Dec 2005 10:51:48 local, seen in news:comp.lang.javascript, Evertjan.
<exjxw.hannivoort@interxnl.net> posted :[color=blue]
>
>Make the url different each reload, something like:
>
>var dummy=new Date()
>myIfame.location.href='/cgi-bin/mycgi?inputname=inputvalue&dummy='+dummy[/color]

That might work, or it might work only once per day; I'd suggest

var dummy = +new Date()
myIfame.location.href='/cgi-bin/mycgi?inputname=inputvalue&dummy='+dummy

or just

.... = '/cgi-bin/mycgi?inputname=inputvalue&dummy='+ +new Date()

in which the last space is necessary.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Evertjan.
Guest
 
Posts: n/a
#6: Dec 7 '05

re: Reload a html file in an IFrame


Dr John Stockton wrote on 07 dec 2005 in comp.lang.javascript:
[color=blue]
> JRS: In article <Xns972478AF4E461eejj99@194.109.133.242>, dated Tue, 6
> Dec 2005 10:51:48 local, seen in news:comp.lang.javascript, Evertjan.
> <exjxw.hannivoort@interxnl.net> posted :[color=green]
>>
>>Make the url different each reload, something like:
>>
>>var dummy=new Date()
>>myIfame.location.href='/cgi-bin/mycgi?inputname=inputvalue&dummy='+dummy[/color]
>
> That might work, or it might work only once per day; I'd suggest
>
> var dummy = +new Date()
> myIfame.location.href='/cgi-bin/mycgi?inputname=inputvalue&dummy='+dummy
>[/color]

good idea

or:

myIfame.location.href=
'/cgi-bin/mycgi?inputname=inputvalue&MadRandom='+Math.random ()

[color=blue]
> or just
>
> ... = '/cgi-bin/mycgi?inputname=inputvalue&dummy='+ +new Date()
>
> in which the last space is necessary.[/color]

Second space from the right too.
You did mean that one, I presume?

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Closed Thread


Similar JavaScript / Ajax / DHTML bytes