Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing the browser

Status
Not open for further replies.

jemminger

Programmer
Jun 25, 2001
3,453
US
Hi all,

This code allows any window to be closed without a prompt, regardless of whether it was opened via script or not.

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

As you can see in thread216-358033, it has sparked some debate - my personal opinion is yes, it can be misused, but so what? the person misusing it would only be shooting themselves in the foot by closing their visitor's window.

feel free to comment!
=========================================================
if (!succeed) try();
-jeff
 
Hi mate,

I see this from both sides.

The code could easily be used to launch a new window, then close the parent. This situation leaves the user with no browser history of the visited sites and therefor unable to return to a previous site as easy as they should be able to.

On the other hand, there are a few situations where this code could be very useful.

Most code if misused could cause problems like this or even a lot worse.

Hope this helps Wullie

sales@freshlookdesign.co.uk

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
I really don't think this is much of an issue. As was posted in the other thread it is not much use. Should you visit a site that closes your browser window, will you return? Unlikely. The same goes with any site or you could extend this to television. If you don't like it you as a user have the option and free will to ignore/turn off/never visit. The annoying site. If a site is garish and has lots of pop up windows you don't have to go back. Like those sites that have a million javascript alerts just because they can. They claim you can't get rid of it until the javascript has run it's course. However as a use you have the option to use task manager to close the site and will likely never visit it again. That'l do donkey, that'l do
[bravo] Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top