Closing a webpage without confirmation

Posted on 2007-08-01
Last Modified: 2012-05-05
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" ?

Question by:Faraj1969
    LVL 25

    Expert Comment

    You will always see prompt if you try to close a window that you did not page using javascript method. Closing the child window using window.close() method will not show the prompt.

    LVL 24

    Accepted Solution

    You may be able to close it with this:
    *** window hack removed *** mplungjan, ee page editor
    return false;

    LVL 6

    Assisted Solution

    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.
    LVL 5

    Expert Comment

      The window only opend by only can be closed by window.close with out prompt. Otherwindows surly ask for prompt.
    LVL 75

    Expert Comment

    by:Michel Plungjan
    @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

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Suggested Solutions

    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
    A Change in PHP Behavior with Session Write Short Circuit ( (Winter 2014)** With the release of PHP 5.6 the session handler changed in a way that many think should be considered a bug.  See the note …
    This video teaches users how to migrate an existing Wordpress website to a new domain.
    Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now