Link to home
Start Free TrialLog in
Avatar of johnsm
johnsm

asked on

window won't close

I have a page that opens a new window, lets the user chose some options and then when they hit submit, the cgi page does it's thing and then closes the new window. I have one user, though, in which the window will not close. We are all using IE 5.5 with very similar computers all running WIN95. I can't figure out why it only happens with this one user.

I am using the following code to redirect the parent window and then close the pop up window:

<script language=javascript>
 function go() {
  top.opener.window.location.href = "http://wheretoreturn";
  setTimeout(closemyself(), 10000);
 }
 function closemyself() {
  self.close();
 }
</script>

It works fine for everyone else. What could be the problem on this one pc? (Other than this little quirk, the pc has no other known problems and loads all other web pages correctly.)

When the script executes, the parent window does not get redirected and the child window does not close. I do not get any javascript errors in the browser. It just seems to die right there. I can close the window manually and then everything works fine again until they open the child window back up.

I have also tried changing the duration of the timeout and that seems to have no effect; the results are the same.

Thanks.
Avatar of CJ_S
CJ_S
Flag of Netherlands image

setTimeout("closemyself()", 10000);

Regards,
CJ
you can also just do self.close() instead of the setTimeout. It doesn't really matter.

regards,
CJ
ASKER CERTIFIED SOLUTION
Avatar of a.marsh
a.marsh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of johnsm
johnsm

ASKER

Thanks guys but,

CJ, using the quotes made it stop working for everyone. I need the timeout because if I do not use it, it won't close for anyone.

Ant, your suggestion didn't work either. I tried it and the child window does not close.

Avatar of johnsm

ASKER

Correction: I need the timeout because if I don't use it, the child window closes before the parent window redirects itself.
You said:

... the parent window does not get redirected and the child window does not close....


So is it the case that the parent does now direct?

top.setTimeout("top.close()", 10000);


Can I just ask, is the child window using frames at all? If not then we don't need to use "top"

Ant
Avatar of johnsm

ASKER

Ah Ha,

Avatar of johnsm

ASKER

Ah Ha,

Avatar of johnsm

ASKER

wow, I don't know what happened there. Sorry for the incomplete double post.

Thanks Ant, it works now. I was entering your info incorrectly. I still don't know what caused the other problem, but it is gone and that's all that matters.
I think it is because I got rid of the "window" part of the first line - the opener ovject already refers to the window.

:o)

Ant