closing window ... without getting system message....?

  • SPooja
  • Newbie
  • Newbie
  • SPooja
  • Posts: 7

Post 3+ Months Ago

opening a new asp page ....i want to close this asp page.... and using the close method for this...
But getting a system msg ... i dont want the system message to come...
how to do this.... :?: :?: :!:
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9086
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

I am not sure I understand exactly what you are asking. Did you create a popup and then you have a link that is supposed to close the popup or webpage?

Also what is this system message you are getting?
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Perhaps Dreamer7 's answer from back in April will help you solve it:
dreamer7 wrote:
well after all that looking around at the time i suddnely coem across it earlier while looking for something else but here it is the code that stops it from prompting u asking if u want to close the window so its what uve all been waiting for lol..
Code: [ Select ]
window.opener = null
window.close()
return false
  1. window.opener = null
  2. window.close()
  3. return false

so ppl put this after ur window.open() statement or if u want to just close the window wen u click it then its..
Code: [ Select ]
<a href="#" onclick="window.opener=null; window.close(); return false">thelinkbuttonorwhatever</a>


ok ppl i hope that helped y'all it definitely helped me lol
d7


I tried this method and it works without brinking up the "Close Window Confirmation" alert box. The entire thread is here:

http://www.ozzu.com/viewtopic.php?p=2500

It does sound as if you are trying to close the parent window from the child window. In which case just include the window.opener=null part in your function to close the parent window.

There is another method described in this thread (I think the original poster was trying to do the same thing you are):
http://www.dhtmlshock.com/forum/topic.asp?TOPIC_ID=835

Perhaps that will provide an alternative method. I know the first one works for sure, but I was only trying to close the page after a successul form submission.

Hope that helps.
  • SPooja
  • Newbie
  • Newbie
  • SPooja
  • Posts: 7

Post 3+ Months Ago

ATNO/TW wrote:
Perhaps Dreamer7 's answer from back in April will help you solve it:
dreamer7 wrote:
well after all that looking around at the time i suddnely coem across it earlier while looking for something else but here it is the code that stops it from prompting u asking if u want to close the window so its what uve all been waiting for lol..
Code: [ Select ]
window.opener = null
window.close()
return false
  1. window.opener = null
  2. window.close()
  3. return false

so ppl put this after ur window.open() statement or if u want to just close the window wen u click it then its..
Code: [ Select ]
<a href="#" onclick="window.opener=null; window.close(); return false">thelinkbuttonorwhatever</a>


ok ppl i hope that helped y'all it definitely helped me lol
d7


I tried this method and it works without brinking up the "Close Window Confirmation" alert box. The entire thread is here:

http://www.ozzu.com/viewtopic.php?p=2500

It does sound as if you are trying to close the parent window from the child window. In which case just include the window.opener=null part in your function to close the parent window.

There is another method described in this thread (I think the original poster was trying to do the same thing you are):
http://www.dhtmlshock.com/forum/topic.asp?TOPIC_ID=835

Perhaps that will provide an alternative method. I know the first one works for sure, but I was only trying to close the page after a successul form submission.

Hope that helps.



The code
window.opener = null
window.close()
return false

does not solve my problem :(

Actualy...i am opening a asp page in a new window using action and target attribute(s) of <form> tag.I have written the tag something like this
<form name="frm1" action="expdocdaily.asp" target="_new">

There is a close button on this new opened asp page(expdocdaily.asp) . On click event of this close button i am writing window.close to close the new window....but before closing it gives me the "Close Window Confirmation" alert box. I dont want this alert box to appear.

I have gone thru the solution which u have given for this problem in one of the threads as to null out the window.alert(string)
within the window.close event.

But i am not able to do this .... can u please give me the exact code for doing this....or some other idea of how to solve this problem..... :?: :?:
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Here is a working example. (The only difference between what I'm doing and what you are doing is I'm using a text link vs. a button for the close option).

Original page that opens the alert box:
http://housesunlimitedinc.com/cgi-bin/subscribeform.asp

Code: [ Select ]
<a href="#" onClick="window.close();">Close this window</a>


Revised page that works without bringing up the alert box:
http://housesunlimitedinc.com/cgi-bin/closetest.asp
Code: [ Select ]
<a href="#" onclick="window.opener=null; window.close(); return false">Close This Window</a>


As you can see it's the same code as I posted above, and works perfectly on MSIE 6.0; Netscape 7.0 does not show the alert box by either method; This did not work in Netscape 4.78 (surprise, surprise) - and I don't have the patience to try to come up with workarounds for Netscape 4.x anymore. If someone is still using that old browser, then they are just going to have to live with the way it displays pages and handles more current code.

Added note:
Copy and paste the links into your browser to see the alert box pop-up in the original page. Apparently, when clicking on them here, there is no alert box on the simple version of onClick. Steen explained why in the original thread:

Steen wrote:
Apparently you can avoid the alert
if there is only one location in the window's history, so if you open a
child window and close it from within the child window, there is no
message.

It's a Microsoft Security thing!

This problem is not an issue when doing HTA's (applications)
as in:
Invoking the window.close method on an HTA closes the application without prompting the user because the HTA is trusted and follows a different security model.


but in the broswers, it's not the same.

http://msdn.microsoft.com/library/defau ... lose_0.asp


To this date, this is still a *peach* up issue.

I've read comments on flushing out the history before going
to a child window but I'll be damned it I can find a sample anywhere.

sorry ...


Perhaps the Microsoft link he included in the original post gives added insight.
  • SPooja
  • Newbie
  • Newbie
  • SPooja
  • Posts: 7

Post 3+ Months Ago

ATNO/TW wrote:
Here is a working example. (The only difference between what I'm doing and what you are doing is I'm using a text link vs. a button for the close option).

Original page that opens the alert box:
http://housesunlimitedinc.com/cgi-bin/subscribeform.asp

Code: [ Select ]
<a href="#" onClick="window.close();">Close this window</a>


Revised page that works without bringing up the alert box:
http://housesunlimitedinc.com/cgi-bin/closetest.asp
Code: [ Select ]
<a href="#" onclick="window.opener=null; window.close(); return false">Close This Window</a>


As you can see it's the same code as I posted above, and works perfectly on MSIE 6.0; Netscape 7.0 does not show the alert box by either method; This did not work in Netscape 4.78 (surprise, surprise) - and I don't have the patience to try to come up with workarounds for Netscape 4.x anymore. If someone is still using that old browser, then they are just going to have to live with the way it displays pages and handles more current code.

Added note:
Copy and paste the links into your browser to see the alert box pop-up in the original page. Apparently, when clicking on them here, there is no alert box on the simple version of onClick. Steen explained why in the original thread:

Steen wrote:
Apparently you can avoid the alert
if there is only one location in the window's history, so if you open a
child window and close it from within the child window, there is no
message.

It's a Microsoft Security thing!

This problem is not an issue when doing HTA's (applications)
as in:
Invoking the window.close method on an HTA closes the application without prompting the user because the HTA is trusted and follows a different security model.


but in the broswers, it's not the same.

http://msdn.microsoft.com/library/defau ... lose_0.asp


To this date, this is still a *peach* up issue.

I've read comments on flushing out the history before going
to a child window but I'll be damned it I can find a sample anywhere.

sorry ...


Perhaps the Microsoft link he included in the original post gives added insight.


Thanx .... I have upgraded IE to 6.0 and now its working fine. :)

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: ScottG and 69 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.