By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,636 Members | 1,189 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,636 IT Pros & Developers. It's quick & easy.

Popup window not closing using window.close

100+
P: 219
I can't seem to get my popup windows to close properly in IE. They close fine in Firefox. Any suggestions on what I should try?

Expand|Select|Wrap|Line Numbers
  1. <a href="#" onClick="javascript:window.close();">close window</a>
  2.  
I've tried window.close(self) as well, but that's not working either
Jul 28 '08 #1
Share this Question
Share on Google+
7 Replies


acoder
Expert Mod 15k+
P: 16,027
You don't need the "javascript:" part. window.close() should work. So does it just not work or can you see any errors too?
Jul 29 '08 #2

100+
P: 219
You don't need the "javascript:" part. window.close() should work. So does it just not work or can you see any errors too?
I removed the javascript part, but still nothing. It works in Firefox, just not IE. I'm not getting any errors in the statusbar.
Jul 29 '08 #3

100+
P: 219
I removed the javascript part, but still nothing. It works in Firefox, just not IE. I'm not getting any errors in the statusbar.
Actually I take it back. It works in IE6, just not IE7.
Jul 29 '08 #4

acoder
Expert Mod 15k+
P: 16,027
Can you produce a small version of your code that demonstrates the problem?
Jul 29 '08 #5

100+
P: 219
Can you produce a small version of your code that demonstrates the problem?
I think it has to do with the popup windows and how I'm opening them, not sure though.

Here is some of the code:

Expand|Select|Wrap|Line Numbers
  1. ***** index.cfm code portion *****
  2. <cfif session.access eq 'admin'>
  3.                 <li><a href="##" onclick="popup('emulation.cfm',140,500,'emulation');">Emulation</a></li>
  4.                 <li><a href="##" onclick="alert('Under Development');">Administration</a></li>
  5.             </cfif>
  6.  
  7. ***** emulation.cfm code portion  *****
  8. <a href="#" onclick="window.close();">close window</a>
  9.  
  10. ***** javascript popup function *****
  11. function popup(url,height,width,mywindow,scrollbars){
  12.     params="height=" + height + ",width=" + width + ",scrollbars=" + scrollbars + ",status=1";
  13.     window.open(url,mywindow,params);
  14. }
  15.  
Jul 29 '08 #6

100+
P: 219
It might be the system I'm testing on. I just opened the page on another computer, and all of the popup windows close with no problem.....hmmmmm
Jul 29 '08 #7

acoder
Expert Mod 15k+
P: 16,027
Check your browser settings then.
Jul 29 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.