Solved

window won't close

Posted on 2001-08-08
10
236 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 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

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 …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

691 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