Solved

how to detect browser close when 'X' clicked

Posted on 2014-11-10
5
213 Views
Last Modified: 2015-01-02
Hi, this is on a internal web app with php/javascript and how could we detect when the browser app is closed when pressed X with javascript. Thanks.
0
Comment
Question by:nevyana2006
  • 2
5 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 40433650
window.onbeforeunload = function() {
      return "noooooooo!!!!";
}

test page : http://jsfiddle.net/cfnjmk6L/
0
 

Author Comment

by:nevyana2006
ID: 40433728
regret that affects another function
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 40433735
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

809 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