Solved

window won't close

Posted on 2001-08-08
10
232 Views
Last Modified: 2012-08-13
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.
0
Comment
Question by:johnsm
  • 5
  • 3
  • 2
10 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 6364394
setTimeout("closemyself()", 10000);

Regards,
CJ
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 6364396
you can also just do self.close() instead of the setTimeout. It doesn't really matter.

regards,
CJ
0
 
LVL 15

Accepted Solution

by:
a.marsh earned 100 total points
ID: 6364406
I would go a little further than that and use:

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


Ant
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 1

Author Comment

by:johnsm
ID: 6364474
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.

0
 
LVL 1

Author Comment

by:johnsm
ID: 6364488
Correction: I need the timeout because if I don't use it, the child window closes before the parent window redirects itself.
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6364850
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
0
 
LVL 1

Author Comment

by:johnsm
ID: 6365212
Ah Ha,

0
 
LVL 1

Author Comment

by:johnsm
ID: 6365213
Ah Ha,

0
 
LVL 1

Author Comment

by:johnsm
ID: 6365219
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.
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6365663
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
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question