Solved

Prevent user from closing form

Posted on 2007-11-28
4
306 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 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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 250 total points
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
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…

771 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

10 Experts available now in Live!

Get 1:1 Help Now