Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

window won't close

Posted on 2001-08-08
10
Medium Priority
?
239 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 400 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

618 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