Results 1 to 2 of 2

Thread: [RESOLVED] How to stop closing a web browser when user clicks a close button

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2006
    Posts
    116

    Resolved [RESOLVED] How to stop closing a web browser when user clicks a close button

    HI

    Can any one advise me how to stay in the web page when a user clicks on the "X"(upper right corner of a web page) button of a web page?

    i wrote a java script function in beforeOnUnload event of a page , when user clicks on the "X" button i am geting a my own alert message saying taht r u want to close the web page click yes else click no.

    function handlewebpageCloseEvent(){
    // code to show alert message yes / no
    var sconfirm = ///gets a values yes / no
    if (sconfirm== 'yes')
    {
    window.close();

    }else{
    window.event.returnvalue=false;
    // this is agian opening a new alert message whether users wants to navigate to a new page or stay in the same page

    }

    when a user clicks yes my web page is closing ,but when a user clicks "no". its opening a alert message whether users wants to navigate to a new page or stay in the same page

    i dont want the second alert message , can any one advise me how to stay in the same web page.
    Last edited by vkkishore_s; Jul 20th, 2011 at 07:09 AM. Reason: edit the subject

  2. #2
    New Member
    Join Date
    May 2012
    Posts
    1

    Re: [RESOLVED] How to stop closing a web browser when user clicks a close button

    I am also facing same problem.Can you please how we can sort out this problem?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width