?
Solved

window won't close

Posted on 2001-08-08
10
Medium Priority
?
240 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 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article discusses how to create an extensible mechanism for linked drop downs.
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…
Suggested Courses

831 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