473,804 Members | 2,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Code to Exit Web App and Exit Internet Explorer

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!

--
Sandy
Nov 19 '05 #1
6 2891
Sandy wrote:
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!


You could use: this.window.clo se(); (JavaScript)
But that won't work in all browsers, and depending on the Security level
of the browser, it will always prompt the user, or just ignore it.

/RT
Nov 19 '05 #2
Everything in the HTML document belongs to you. JavaScript also gives you
the ability to manipulate some things in the browser itself, things that are
temporary properties of the window, and only a few things, as the browser
window really belongs to the user. The further away you get from the HTML
document itself, the less likely you are going to have control, and that is
a good thing. The HTML document is a guest on the user's computer. A good
guest doesn't try to rearrange the furniture in the host's home.

However, some guests are just plain rude. They are like door-to-door
salemen, who, when you try to close your front door, stick their foot in the
crack, to prevent you from doing so. The Internet is full of all kinds of
people, from the best to the worst. Porn sites have been among the worst
offenders, but other "sales" - type sites have followed suit, with pop-up
ads that open other pop-up ads, windows that hide themselves, etc., in
effect, trying to force the user to do something they do not want to, like a
bad guest. So, browser and Operating System manufacturers have been working
on ways of preventing these bad guests from rearranging your furniture
without your permission, while still enabling HTML documents to be helpful
and useful in as many ways as possible. This is a difficult task, as one
goal seems to run against the other, and both are equally desirable.

Now, here's where I'm going with this: The user has opened a browser window
on his/her computer, to browse the Internet. He/she may want to use that
same browser window to go somewhere else when he/she is through with your
web site. Now, there are JavaScript functions like window.open() and
window.close() that can be used by an HTML document to open a new browser
window (similar to a dialog box, or help window, for example), or close a
browser window that it has opened. In fact, the JavaScript window.close()
method used to be able to close the window which the user opened, and, in
some browsers, still can, with a bit of tweaking.

However, when designing a web site, or a web application (which is, to the
user, the same thing), one must be aware of these issues, and sensitive to
the user's desires, if one wants to generate traffic to one's web site, and
keep people coming back. In other words, one must be a good guest in order
to be invited back.

Among the changes that have been made are changes to the window.close()
method. A window that has been opened by an HTML document using the
JavaScript window.close() method can close itself, with no problems. It can
also be closed by the window that opened it. But a window that the user has
opened may or may not be able to close itself. In most cases, the browser
will prompt the user first, ask permission to close the window, like a good
guest.

Now, there is a workaround for this, as with most programming technologies.
How does the browser know who opened it? It has a public property called
"opener" which is a browser window. When the user opens the window, the
opener is null. When an HTML document opens a window, the opener is the
window that opened it. So, you can usually set the "opener" property to the
current window, and this will fool (at least) most browsers. Example:

window.opener = self;
window.close();

However, I would not be surprised if, at some near point in the future, this
property was made read-only by browser manufacturers, as they are aware of
this trick, and I can't think of a single reason why it should be settable,
except by the browser software, other than to spoof the browser as I have
illustrated above.

Now, the reason I've gone into all of this is that, when designing a web
application, one should be sensitive to the needs and desires of the user.
Otherwise, one will not have very many users. So, a good rule of thumb is,
be a good guest. Don't try to mess too much with the user's browser. Use
what you know wisely, and don't abuse your power!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Everybody picks their nose,
But some people are better at hiding it.
"Sandy" <Sa***@discussi ons.microsoft.c om> wrote in message
news:6E******** *************** ***********@mic rosoft.com...
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!

--
Sandy

Nov 19 '05 #3
In article <OE************ **@TK2MSFTNGP09 .phx.gbl>,
ke***@DIESPAMME RSDIEtakempis.c om says...

<snip>
Now, the reason I've gone into all of this is that, when designing a web
application, one should be sensitive to the needs and desires of the user.
Otherwise, one will not have very many users. So, a good rule of thumb is,
be a good guest. Don't try to mess too much with the user's browser. Use
what you know wisely, and don't abuse your power!


Thank you, Kevin, that was said much more politely than the response I
was considering.

In usability, there is a heuristic known as the "rule of least surprise"
which basically says not to do anything that the user doesn't expect
you to do. Software that tries to anticipate what a user might do will
often guess wrong, and usually in ways that are very irritating.
Software that assumes "I know better" when it's messing with things in
the user's domain will almost always get it wrong.

Diane
Nov 19 '05 #4
Thanks All for your responses.

I guess I was unclear as to the context of my usage of this. I have a
little "demo" that is opened by a user clicking a link that I supply. When
the demo is over, I wanted to clean up after myself by giving them a button
they can click on to exit.

Is there anything wrong with this being used for this particular purpose?

--
Sandy
"Sandy" wrote:
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!

--
Sandy

Nov 19 '05 #5
> Is there anything wrong with this being used for this particular purpose?

Not at all. Anything that gives control to the user is welcomed by the user.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Everybody picks their nose,
But some people are better at hiding it.

"Sandy" <Sa***@discussi ons.microsoft.c om> wrote in message
news:3D******** *************** ***********@mic rosoft.com...
Thanks All for your responses.

I guess I was unclear as to the context of my usage of this. I have a
little "demo" that is opened by a user clicking a link that I supply.
When
the demo is over, I wanted to clean up after myself by giving them a
button
they can click on to exit.

Is there anything wrong with this being used for this particular purpose?

--
Sandy
"Sandy" wrote:
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!

--
Sandy

Nov 19 '05 #6
In article <3D************ *************** *******@microso ft.com>,
Sa***@discussio ns.microsoft.co m says...
Thanks All for your responses.

I guess I was unclear as to the context of my usage of this. I have a
little "demo" that is opened by a user clicking a link that I supply. When
the demo is over, I wanted to clean up after myself by giving them a button
they can click on to exit.

Is there anything wrong with this being used for this particular purpose?

No, in a window that the same app created, it's not a problem, although
I'd more than likely use the close box on the window frame.

Some of us have dealt with enough bad web applications that we get a
little skittish, is all.

Diane
Nov 19 '05 #7

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

Similar topics

2
7643
by: esrkq | last post by:
Hi, I am looking at a way to return IP related information of a visitor loading a web page and found the following snippet of code: if(navigator.javaEnabled() && (navigator.appName != "Microsoft Internet Explorer")) { vartool=java.awt.Toolkit.getDefaultToolkit(); addr=java.net.InetAddress.getLocalHost(); host=addr.getHostName();
11
2074
by: Shawn Milo | last post by:
I put this together yesterday, and I thought I'd share it. It works in both IE and Mozilla Firefox. I posted something similar to this months back, but it was much longer, and only worked in IE. Shawn function searchList(inText, drpBox){ var iCount;
5
2206
by: CreepieDeCrapper | last post by:
i have a simple JS window.open function that i'm calling and it works great here: http://demo.creationsite.com/GLBC/www/ (click on "virtual tour" in the yellow text link) - no status bar - proper title in title bar (same as main window)
2
2297
by: CathieC | last post by:
I have a websote developed using visual studio 2005 beta , .net version 2 i deploy my application to a server and it is run from client computers. One of the users gets the error "Internet Explorer cannot open the internet site "XXXXX" Operation aborted" this happens when they click on a menu item to open a page. they do not get
2
1234
by: Husam | last post by:
Hi EveryBody: I have the following code which just helpfull with Notepad: Code: <DllImport("user32", CharSet:=CharSet.Auto, SetLastError:=True)> _ Public Shared Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As Integer ' End Function
0
840
by: Husam | last post by:
Hi everybody: I have the following cod whcih I got it from one news group and I said to It let the internet explorer start navigate in the same window but when I try it I found nothing this si the code: Option Explicit Private MyExplorer As InternetExplorer Private Sub Command1_Click()
3
2356
by: VK | last post by:
Internet Explorer 7 beta 2 preview CNET Editor review: <http://reviews.cnet.com/Internet_Explorer_7_for_XP_SP2_Beta_2/4505-3514_7-31454661-2.html?tag=nl.e415> Summary (my personal review interpretation): "Half stolen from Firefox, half is buggy - including the stolen part". Download: <http://www.download.com/Internet-Explorer-7/3000-2356_4-10497433.html?tag=nl.e415>
3
11500
by: laredotornado | last post by:
Hi, This problem only affects PC IE. On a secured page (a page visited via https), there is a link that reads -- "Download HTML File". The link connects to this page <?php require("../../util_fns.php"); session_start();
1
2461
by: -Lost | last post by:
This is more of a post to inform, unless of course I am missing something fundamental, in which case I would appreciate anyone explaining it. Based on Mr. Michaux's camelizeStyle function I wrote: function create_style(style) { var p = document.createElement('p'); var t = document.createTextNode('Just something to fill the P.');
0
9715
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
9595
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
10603
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
10353
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
10356
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
10099
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
5536
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
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3836
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.