Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Prevent user from closing form

Posted on 2007-11-28
4
Medium Priority
?
324 Views
Last Modified: 2008-02-01
HI All,

Is there a way to stop a user from closing windows explorer when they click on the X button on the top left of internet explorer?
0
Comment
Question by:joan2006
4 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 1000 total points
ID: 20365693
Not if they REALLY want to leave.
I think you want

<body onBeforeUnload="returnValue='Please fill it out before you leave'">
0
 
LVL 40

Expert Comment

by:evilrix
ID: 20365990
There is no way to prevent this. You need to design your application to take this into account. So, for example, do not commit form details to a database until you have captured and validated all necessary input; otherwise, you might ruin your database integrity.
0
 
LVL 6

Expert Comment

by:Roopesh_7
ID: 20366010
When you use window.open, you can set titlebar to no or 0, but it is usually ignored, see link.
The alternative is to create a draggable div instead of a popup.
this link will help you

http://www.thescripts.com/forum/thread617779.html
0
 
LVL 1

Assisted Solution

by:itsbth
itsbth earned 1000 total points
ID: 20366055
This code should work. Remember that a visitor might be irritated by the fact that he has to press yes to exit. You can disable it by setting window.onbeforeunload to null.
window.onbeforeunload = function(){
	return "Are you sure you want to close the window?"
}

Open in new window

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
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…
Suggested Courses

824 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