1.

Solve : Window not refreshing after popup closed?

Answer»

This is designed to refresh the original window when the popup widow is closed. It isn't working.

Code: [Select]<script type='text/javascript'>
function lola(p) {
if(p.closed == true) {
return false;
}
else {
return true
}
}
function run(p) {
lola(p);
}
function Wait(time,p) {
SETTIMEOUT("run(p);", time);
}
function CSH() {
p = window.open('http://quackit.com/common/link_builder.cfm','popUpWindow','height=500,width=400,left=100,top=100,resizable=yes,
scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes');
if(Wait(100, p)) {
location.reload(true);
}
}
</script>Use window.location.reload() to reload the page.How would I loop the (

if(Wait(100,p)) {
location.reload(true)
}
)
part?What is the argument and condition? You'd either be using a for or a while loop.O-my-gosh! It won't work.

Can you just give me one small thing that will do this:

if "p" .closed = true then reload the page or else wait 1 second and repeat

That would be best...
What I am using this for:
I am making a "CREATE new page" link. It will open "p" as a new window. When they close the window, it refreshes the original window.LOL me and loops = no no.

I never quite got the hang of them in JS. Maybe Rob could lend a helping hand? Okay, then this is saying Object Expected; I am looping it this way:

function CSH(p) {
setTimeOut("function(p) { if(true == p.closed) { window.location.reload(true); } else { CSH(p); return false; } }", 10);
}Is there a JS STATEMENT called "closed"? I don't think there is...You'll have to declare that somehow by using what's available.
Unless you tell the browser what "p.closed" means, then it's not going to work.How would I tell it?
This is a code I got from a website:

function checkIfClosed() {
newWindow = window.open("http://", "popupWindow", "scrollbars=no;")
if (newWindow.closed)
   ifClosed()
else
   ifNotClosed()
}Maybe it is RIGHT so, it kind of rings a bell with me.

I really can't help with the loop though, sorry.K, www.webstarts.com did it without looping.
Have any clue how to make a button that will refresh that window onClick that could be INSIDE the popup? That's what they did.Better example of setTimeOut() usage >here<.So... This?

Code: [Select]<script type='text/javascript'>
function CSH(p) {
stop = false

if(p.closed) {
stop = true;
window.location.reload();
}
if(stop == false) {
setTimeout("CSH(p)", 3000);
}
}
</script>Yay it worked! Thanks for all your help!Well done!



Discussion

No Comment Found