Solved

How to close a main browser window?

Posted on 2002-03-20
6
203 Views
Last Modified: 2012-05-04
I would like to provide the functionality to close a browser session.  I've found the JavaScript function self.close() and attached it to a button.  Problem is when I use this button a pop-up window first appears asking if I want to close.  I don't want this window...I simply want to close.

0
Comment
Question by:mskvarenina
  • 4
6 Comments
 
LVL 30

Accepted Solution

by:
third earned 50 total points
ID: 6884318
you can't prevent that from happening. it's one of the limitation of what scripts can do with the browser. that would only work with child windows but with the main window it will always come out ;-(. so your option is either stick with it or don't use it.
0
 

Author Comment

by:mskvarenina
ID: 6884346
Wow, so there's no other means at all?  I mean without using self.close()...mayne there's another way?
0
 
LVL 30

Expert Comment

by:third
ID: 6884436
sorry to tell you but there is no other way. this question was asked a lot of times but they've done nothing but to stick with it. ;-(

the other way is by clicking the [X] button on the top-right of your browser's window. ;-) (lol)
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 18

Expert Comment

by:bruno
ID: 6884508
just backing up what third has told you....


trying to close a window by javascript will always get you that prompt UNLESS the window was opened with javascript.

no other way to close it though....because the user opened it, the user has to close it.  i'd be pretty mad if some site just magically closed my browser.....!!!


BRUNO
0
 
LVL 30

Expert Comment

by:third
ID: 6884543
thanks for the backup bruno... ;-)

convinced ??
0
 
LVL 30

Expert Comment

by:third
ID: 6884561
;-)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
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)

840 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