473,657 Members | 2,496 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Urgent How to prevent that Internet Explorer is closed

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
Jul 20 '05 #1
5 6920
"Clemens Ortwickler" <er*****@gmx.at > writes:
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?


You can't. Redesign your application.
Will clicking your cancel button make a difference if the user isn't
connected to the internet any more?

You can *try* using the window.onunload handler. However, that also
triggers if the user tries to navigate away from the window, so it's
not your best guess. You should also expect the page to disappear,
so don't start anything that takes time in the handler. If really
desperate, you can open a new window (but expect every popup-blocker
out there to try to stop it).

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
Clemens Ortwickler wrote on 25 Nov 2003:
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?


I would really hope not: pop-up writers would have a field day with
that.

What you might be able to do (depending on what happens when the
cancellation occurs) is use the onunload intrinsic event to perform
whatever action the user is supposed to. If you're trying to write a
cookie or something similar, it should be fine. However, if it
involves navigating to another page, it won't help.

Mike

--
Michael Winter
M.******@blueyo nder.co.uk.invalid (remove ".invalid" to reply)
Jul 20 '05 #3
You can't. Redesign your application.
Will clicking your cancel button make a difference if the user isn't
connected to the internet any more?


Thats very bad damn.... It is a local application so it doesn't matter. I
send HTTP Request to my Application and there should be a Request when you
click on the okay button the cancel button and when you close the Browser.
So if I use the unload method and i push the okay button i got 2 Requests
one for the unload handler and one for the okay button...

thats bad really bad but nevertheless thanks for your help!
Jul 20 '05 #4
Clemens Ortwickler wrote on 25 Nov 2003:
You can't. Redesign your application.
Will clicking your cancel button make a difference if the user
isn't connected to the internet any more?


Thats very bad damn.... It is a local application so it doesn't
matter. I send HTTP Request to my Application and there should
be a Request when you click on the okay button the cancel button
and when you close the Browser. So if I use the unload method
and i push the okay button i got 2 Requests one for the unload
handler and one for the okay button...

thats bad really bad but nevertheless thanks for your help!


You could have onclick handlers on the two buttons set a global that
the onunload event checks. If it's set, the onunload exits without
doing anything, and if not it does it's work. However, I'd take Mr
Nielsen's advice and find a new approach.

Mike

--
Michael Winter
M.******@blueyo nder.co.uk.invalid (remove ".invalid" to reply)
Jul 20 '05 #5
Clemens Ortwickler wrote:
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


<strong>
Warning: Do not close this window! If you wish to
cancel the process, please click the "Cancel" button.
</strong>

Simple, and works with any browser.

Jul 20 '05 #6

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

Similar topics

10
2386
by: milk-jam | last post by:
I'm trying to write a log which save each time internet explorer is opened or closed and all of the url which where visited? Any help is greatly appreciated.
3
4134
by: Simon | last post by:
Hi, I need to prevent Internet Explorer to save the page in history collection when it is in PostBack. To try do this I have put this code: protected override void OnLoad( EventArgs evt) { if (IsPostBack) Response.Cache.SetNoStore(); ..... base.OnLoad( evt);
6
2887
by: Sandy | last post by:
Hello - I have a little application that I would like to have an exit button on that closes my web application and closes Internet Explorer. What is the code that will do that? Any help will be greatly appreciated! --
3
3062
by: ckirchho | last post by:
Halo, I am trying to realize a two column layout basically like this: <html> <head> <style> leftCol { float: left; width: 15em; }
11
11610
by: Wendy | last post by:
Hello, I have a program that does the following: When a user clicks on a row in a VB.NET datagrid, it will open a web page in Internet Explorer (that corresponds to that item in the selected row in the datagrid). It will automatically print that web page, and then it will close the Internet Explorer window. I have code that works perfectly when a regular web page is opened, however when a pdf web page is opened the printing never...
16
3786
by: danep | last post by:
Hi all, On my site I have a section of code that resembles the following: <p id="gear" style="display: none;"> <p>test</p> </p> This renders fine in Firefox (that is, nothing is displayed). However, in Internet Explorer, "test" is still printed. It appears
28
3583
by: Neo Geshel | last post by:
NOTE: PAST EXPERIENCE HAS SHOWN ME THAT MANY ON USENET FAIL TO READ ARTICLES PROPERLY PRIOR TO ANSWERING. I AM LOOKING FOR VERY SPECIFIC INFORMATION, THEREFORE PLEASE READ AND UNDERSTAND THOROUGHLY BEFORE RESPONDING; OR ASK QUESTIONS TO CLARIFY. I *WILL* APPRECIATE ANY CONSTRUCTIVE REPLY. Greetings! I am in the process of creating a template for a site. The site will be *true* XHTML 1.1. That is, it will validate as XHTML 1.1 on...
4
4426
by: eschneider | last post by:
I get the following error when trying to browse the .asmx. I get the same thing when trying to add a reference. using .NET 2.0 There is no error message. Any ideas? Thanks,
2
3148
by: swethak | last post by:
Hi, I am getting the problem the problem with google map in Internet Explorer. This map worked fine in mozilla . When i opened the same map in Internet Explorer i am getting the error message as in alert box as " Internet Explorer cannot open the Internet site http://google.citycarrentals.com.au/viewalllocations.php . Operation aborted". It is working in Mozilla . Here i mentioned my code . I am facing this problem several...
0
8421
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8742
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
8518
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
8621
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7354
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 project—planning, coding, testing, and deployment—without 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
4173
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...
1
2743
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
2
1971
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1734
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.