Solved

window won't close

Posted on 2001-08-08
10
230 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
 
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now