473,729 Members | 2,121 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 2549
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
2578
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
6928
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
7575
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
2283
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
3021
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
2178
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
8766
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9428
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9291
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...
0
8163
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...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6026
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
4536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4799
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3244
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

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.