• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1939
  • Last Modified:

Closing a webpage without confirmation

Hi, How can I close a web page using vb .net without the silly confirmation message that comes saying "The webpage your are viewing is trying to close the window" ?

Cheers
0
Faraj1969
Asked:
Faraj1969
2 Solutions
 
nauman_ahmedCommented:
You will always see prompt if you try to close a window that you did not page using javascript window.open() method. Closing the child window using window.close() method will not show the prompt.

--Nauman.
0
 
DBAduck - Ben MillerPrincipal ConsultantCommented:
You may be able to close it with this:
*** window hack removed *** mplungjan, ee page editor
window.close();
return false;

Ben.
0
 
gjutrasCommented:
Here's a quote I found about window.close()

There is one thing that you should know about this code.  If you use the close method on a window that was not opened using script, Internet Explorer displays a message asking visitors if they want to close the window.  In Netscape Navigator and Mozilla, the code won't work at all, and the JavaScript console displays the message "Scripts may not close windows that were not opened by script."  So this example works best in a page that you display in a popup window using script code similar to the code I provided in my earlier post, open a page in a new window, mentioned above.
0
 
kumar_jacCommented:
Hi,        
  The window only opend by window.open only can be closed by window.close with out prompt. Otherwindows surly ask for prompt.
0
 
Michel PlungjanIT ExpertCommented:
@dbaduck: Please do not post this code on EE. It is a hack and it can be used for denial of service.
mplungjan, ee page editor
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now