473,652 Members | 2,979 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Prevent window closing


Is there a way I can prevent the browser window from being closed? I'd
like to make sure the browser window only closes programatically (I want
to make sure the user enters data before moving on).

Another possible solution would be to re-open the window when it's
closed.

Any help is appreciated, thanks.
Jul 20 '05 #1
11 2535
danny wrote:
Is there a way I can prevent the browser window from being closed?
No. (Although porn sites with hundreds of blinking banner adverts would love
it if it were possible)
I'd like to make sure the browser window only closes programatically (I
want to make sure the user enters data before moving on).


This is the web. You can't force the user to do anything. Make the
application robust enough to survive the user doing the unexpected.

--
David Dorward <http://dorward.me.uk/>
Jul 20 '05 #2
In article <bs************ ******@news.dem on.co.uk>, do*****@yahoo.c om
says...
danny wrote:
Is there a way I can prevent the browser window from being closed?
No. (Although porn sites with hundreds of blinking banner adverts would love
it if it were possible)


I bet!
I'd like to make sure the browser window only closes programatically (I
want to make sure the user enters data before moving on).


This is the web. You can't force the user to do anything.


Actually, It's not for an internet application. I'm building a thin
client application. It's a call center application, and when a contact
is closed, they are supposed to enter data. Problem is, because it's a
browser, they can just click the X mark and close the window, which
leaves the contact waiting for data to move to another state. If I
could pop the window back up and request the data again, that is
acceptable, but I haven't yet figured that out.
Make the
application robust enough to survive the user doing the unexpected.


Gee thanks... I thought that's what I *WAS* doing...
Jul 20 '05 #3
@SM
danny a ecrit :

In article <bs************ ******@news.dem on.co.uk>, do*****@yahoo.c om
says...
danny wrote:
Is there a way I can prevent the browser window from being closed?


No. (Although porn sites with hundreds of blinking banner adverts would love
it if it were possible)


I bet!
I'd like to make sure the browser window only closes programatically (I
want to make sure the user enters data before moving on).


This is the web. You can't force the user to do anything.


Actually, It's not for an internet application. I'm building a thin
client application. It's a call center application, and when a contact
is closed, they are supposed to enter data. Problem is, because it's a
browser, they can just click the X mark and close the window, which
leaves the contact waiting for data to move to another state. If I
could pop the window back up and request the data again, that is
acceptable, but I haven't yet figured that out.


supose your funtion to send your data is
function sendData(){ blah blah ; DataOk=1;}

var DataOk =0;
</script></head>
<body onunload="if(Da taOk==0) sendData();"

Would works with IE
Jul 20 '05 #4
In article <3F************ ***@wanadoo.fr> , st************* *@wanadoo.fr
says...
danny a ecrit :

In article <bs************ ******@news.dem on.co.uk>, do*****@yahoo.c om
says...
danny wrote:

> Is there a way I can prevent the browser window from being closed?

No. (Although porn sites with hundreds of blinking banner adverts would love
it if it were possible)


I bet!
> I'd like to make sure the browser window only closes programatically (I
> want to make sure the user enters data before moving on).

This is the web. You can't force the user to do anything.


Actually, It's not for an internet application. I'm building a thin
client application. It's a call center application, and when a contact
is closed, they are supposed to enter data. Problem is, because it's a
browser, they can just click the X mark and close the window, which
leaves the contact waiting for data to move to another state. If I
could pop the window back up and request the data again, that is
acceptable, but I haven't yet figured that out.


supose your funtion to send your data is
function sendData(){ blah blah ; DataOk=1;}

var DataOk =0;
</script></head>
<body onunload="if(Da taOk==0) sendData();"

Would works with IE


Would this prevent the window from unloading? Or would I have to handle
that someplace else?
Jul 20 '05 #5
danny <da*@ebji.org > wrote in
news:MP******** *************** *@news.newsread er.com:
Actually, It's not for an internet application. I'm building a thin
client application. It's a call center application, and when a
contact is closed, they are supposed to enter data. Problem is,
because it's a browser, they can just click the X mark and close the
window, which leaves the contact waiting for data to move to another
state. If I could pop the window back up and request the data again,
that is acceptable, but I haven't yet figured that out.


You need to properly handle that on the server end since you also have to
deal with contingencies like the client machine crashing, the client
machine losing power, or a network outage, all of which could result in no
data being entered at a particular state in the application.
Jul 20 '05 #6
In article <Xn************ *************** ****@130.133.1. 4>,
eb******@earthl ink.net says...
danny <da*@ebji.org > wrote in
news:MP******** *************** *@news.newsread er.com:
Actually, It's not for an internet application. I'm building a thin
client application. It's a call center application, and when a
contact is closed, they are supposed to enter data. Problem is,
because it's a browser, they can just click the X mark and close the
window, which leaves the contact waiting for data to move to another
state. If I could pop the window back up and request the data again,
that is acceptable, but I haven't yet figured that out.


You need to properly handle that on the server end since you also have to
deal with contingencies like the client machine crashing, the client
machine losing power, or a network outage, all of which could result in no
data being entered at a particular state in the application.


Yes, the server side needs to be addressed as well (as you note, clients
purposely closing the window isn't the only issue...) but the big
problem is call transfer. When there's an outage, the switch drops the
call, but when the client closes the window, the call is in limbo on the
switch...
Jul 20 '05 #7
danny wrote:
This is the web. You can't force the user to do anything.
Actually, It's not for an internet application.


If its browser based, then its as good as.
Make the
application robust enough to survive the user doing the unexpected.

Gee thanks... I thought that's what I *WAS* doing...


where the application is the code you execute on the server, not on the
client which is beyond your control (at least if you use a normal web
browser).

--
David Dorward <http://dorward.me.uk/>
Jul 20 '05 #8
@SM
danny a ecrit :

In article <3F************ ***@wanadoo.fr> , st************* *@wanadoo.fr
says...
danny a ecrit :


It's a call center application, and when a contact
is closed, they are supposed to enter data. Problem is, because it's a
browser, they can just click the X mark and close the window, which
leaves the contact waiting for data to move to another state. If I
could pop the window back up and request the data again, that is
acceptable, but I haven't yet figured that out.


supose your funtion to send your data is
function sendData(){ blah blah ; DataOk=1;}

var DataOk =0;
</script></head>
<body onunload="if(Da taOk==0) sendData();"

Would works with IE


Would this prevent the window from unloading? Or would I have to handle
that someplace else?


that would launch your function about your state data
after closing the window
with IE it could (sometimes) works if IE is closed
(doesn't work on an alt+shift+del or alt+F4 )

to re-open the window try :

function reBack(){
open.window(sel f.location);
alert('You have not completed the Data question');}

<body onunload="rebac k();">

or
<body onunload="setTi meout('reback() ',200);">
Jul 20 '05 #9
@SM
"@SM" a ecrit :

to re-open the window try :

function reBack(){
open.window(sel f.location);
alert('You have not completed the Data question');}

<body onunload="rebac k();">

or
<body onunload="setTi meout('reback() ',200);">


Take care you will never more can quite this page !

You have to fix a conditional before

<body onunload="if(!m yData) reBack();">

*myData* would be a global variable
myData = false;
changed to "true" by your function about your Data
when it is called
Jul 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2575
by: NotGiven | last post by:
Say you have three pages, a search page, a results/master, and a detail page. You choose parameters on your search page and submit the page. The results show in the reults/master page. You click one to go the details page. You hit the browser button to go back and it shows the results/master page but shows "Page has expired" error. How can you prevent this? How can you show the results page whether you get
5
6920
by: Clemens Ortwickler | last post by:
Hello Is it possible with JavaScript to prevent that a User is closing the Internet Explorer? Because it is important for me that the User pushes the cancel Button of this webapplication how can i do this? Thanks for your help
22
7565
by: alecjames1 | last post by:
I have a form which the user must complete before closing. I have disabled the window x button and use my own exit button. When selected it checks to see if the user has completed the entries otherwise it cancels the close. However, the user can still right click on the task bar and close my application. Is there any way of preventing this. Thanks Alex
4
410
by: Daniel Walzenbach | last post by:
Hi, does anybody know the JavaScript the guys at Microsoft used in MS CRM to prevent people from closing a browser window and asking them (on the client) what they really want to do? If you don't know what I'm talking about take a look at MS CRM. Open a form, make some changes and try to close the form without saving first. Instead of closing the form you will be asked if you'd like to save first or discard the changes. I have often...
9
2277
by: Daniel Walzenbach | last post by:
Hi I am faced with the following problem: I have a page (let’s call this page page1.aspx) containing some TextBoxes and a hyperlink which opens another page (let’s call this page page2.aspx) as a popup using either window.open or window.showModalDialog. Since I want to warn the users of my application when they try to close page1.aspx and have changed the values in the meantime I thought about using the “onbeforeunload” event of the...
2
3017
by: Tom | last post by:
How is the best way to avoid validation when closing a window? For instance, I have a Windows Forms window which has a validation event for a text box. However, if one enters invalid data in then and then attempts to close the window (either via my custom 'Close' box or by clicking the close 'X' in the upper right window corner), the validation event still triggers and it tells the user that they have invalid data. Which of course means...
2
2171
by: javanet | last post by:
Hi all, 1) i opened a parent window. 2) then i opend a child window thruogh this parent window. Now i want to close child window before closing the parend window means my clients can not be close the parent window without closing the child window. please reply me. if there is any solution for this....
0
8367
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8703
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8467
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7302
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5619
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2703
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1591
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.