faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

3 of 9 people (33%) answered Yes
Recently 3 of 9 people (33%) answered Yes

Entry

How to prevent child-PopUp (B) that was opened by parent (A) from reloading when the A reloads?

Apr 7th, 2008 23:34
ha mo, Fred Jounters, Colin Fraser,


I have been unable to recreate this error. I have used a number of
different open methods but none of them have reloaded the child window
when the parent reloads. Some of them I could not get the parent to
reload, when I used onBlur in the child. The only thing I thought it may
be was associated with frames, but that did not work either. Sorry. Can
you display the code that is going wrong?
Thanks for the reply. Should have been more specific w/regard to what 
I'm trying to do... scusa!
Basically, I have an html-page that opens a popup-window in the 
background that is due to reload every x seconds. The thing is, the 
source of that popup is a cgi-script, and it looks like it gets reloaded 
everytime I try to reload the first page, which is not what i want. It 
proabably has to do with the fact, that it is not a static page (I have 
played with the expire-header thinking that could be the problem, but it 
didn't help).
Here is the html-page loading the popup:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
<HTML> 
<HEAD> 
<TITLE>that</TITLE> 
<SCRIPT LANGUAGE="JavaScript"> 
<!-- 
function myLoginWin() { 
  var LW = window.open("/cgi-bin/admin/remoteUser.cgi?w=4","logWin",
"width=1,height=1,left=200,top=200");
  self.focus();
  }
//--> 
</SCRIPT> 
</HEAD> 
<BODY BGCOLOR="#FFFFFF" onload="myLoginWin();">
Something here...
</BODY> 
</HTML>
And here the popup's source (which is generated from cgi/perl!):
<html><head><title>LoginWindow</title><link rel="stylesheet" 
href="style.css"><meta http-equiv="refresh" content="450;URL=http:
//someserver/cgi-bin/remoteUser.cgi?w=4"></head><body>This popup 
coordinates Your online time! ...</body></html>
So, my approach to the solution would be, to capture the reload-event in 
the popup, and not(!) reload it... The script is only supposed to run 
every 450 seconds, else I think it wouldn't matter and I'd just let it 
reload.
Any ideas?
It bugged me, I just tested it locally with static pages:
In IE and in Opera, the page gets reloaded. See 4 yourself with
test.html:
<html><head><title></title><script language="JavaScript"> 
<!-- 
function myLoginWin() { 
  var LW = window.open("./mytest.html","logWin","width=1,height=1,
left=200,top=200");
  self.focus();
  }
//--> 
</script></head><body onload="myLoginWin();">Something here...
</body></html>
and mytest.html:
<html><head><title></title></head><body>Something here</body></html>
Now load test.html, change mytest.html's text with an editor somewhat, 
save and reload the test.html -> the popup shows the new text of the 
mytest.html. So it has to do with cache/static vs. dynamic, I guess.
How to solve? Thnx!
Fred
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com