View Full Version : How to Close Parent Window w/o Alert?

07-09-2002, 09:56 PM
I'm trying to spawn a toolbar-less window from a link on my desktop. It still throws up an alert box confirming that the user wants the window closed.

Is there a way to close the parent window without alerting the user, particularly since the parent window is there just to spawn the child window (why this is necessary, I'm not sure).


P.S. For more detail, please see this thread:

Soldier Bob
07-09-2002, 10:18 PM
The parent window is opened by the user. What if he doesn't want his Web browser to be closed?

Its a built in function for security reasons last I understood.

You could load up a site map on the parent browser to navigate anthing your loading on the popup. That way at least the content is useful and not just a blank screen.

-S. Bob

07-09-2002, 11:25 PM
Is it possible to make the child the parent and then kill the parent?

Quiet Storm
07-10-2002, 01:18 AM
There is a way to close() the parent window from the child - on IE only, though.


07-10-2002, 03:39 PM
All I need is for it to work in IE. Can you post the code?


Quiet Storm
07-10-2002, 06:06 PM

<OBJECT id="closes" type="application/x-oleobject"
<PARAM NAME="Command" VALUE="Close">

<script type="text/javascript">
function init() {
closes.Click(); }

<BODY onload="init()">

The above will automatically open Page2.html and close the parent onLoad.

To make it work by clicking a button first, remove the onload="init()" command and use this:

<A HREF="#" onClick="javascript&#58;init();">Open & Close!</A>

07-10-2002, 07:41 PM
Many Thanks QS. I've wanted to be able to spawn a window from outside a browser with no toolbars, etc., at a given size for a long time. This seems to be the closest we can get (i.e., first spawning a "dummy" window that's resized to 1px x 1px and then closed.)


07-11-2002, 10:09 PM
Is it possible to have these windows, launched from a shortcut on the desktop be centered?

That would be really nice.


Soldier Bob
07-11-2002, 10:53 PM
geez, build the application already :P

I think what you are really asking is if a browser can be made to behave like a custom app. This isnt a good road to travel upon. If you really need all this and more, you might want to try looking into modifying the mozilla core and open it up to allow for things like this.

From what I understand its open source etc.


-S. Bob

07-11-2002, 11:12 PM
i suggest you leave it alone, period. if it's a built in security feature, then there's gotta be a good reason why you shouldn't be doing it, in which case you'd better have a REAL good reason to bypass it. and i can't imagine such a reason.

on that note, i'd like to politely request, that those few of us, who know how to bypass that security measure, don't tell other people how. the measure is there for a reason, and we're doing no favors by making it easier to get around.

Roy Sinclair
07-11-2002, 11:20 PM
on that note, i'd like to politely request, that those few of us, who know how to bypass that security measure, don't tell other people how. the measure is there for a reason, and we're doing no favors by making it easier to get around.

I also recommend that these "bypass the security" things not be given out for an additional reason. These are bugs in the browser which need to be fixed, not hidden capabilities and when those bugs are fixed this code will suddenly no longer function and your page will break unexpectedly. You don't need that grief so don't try to take advantage of a bug.

FWIW, some more serious problems related to the use of this bug have recently been reported on BUGTRAQ (specifically, unrestricted cross site scripting) and MS will be scrambling right now to disable this so this particular bug is going to have a short life.

07-11-2002, 11:31 PM
For those of us who are looking to get the most out of our browsers, it seems to me a reasonable goal to be able to:

Launch a centered window from a link on the desktop, without all the browser accoutremonts.

For web designers/developers this comes up frequently.



07-12-2002, 12:14 AM
without wanting to sound hostile, i'd like to say that if your design is at the cost of my security, i'd rather have my security.

try looking at HTAs, in the MS link in my sig. that might be what you're looking for.

Quiet Storm
07-12-2002, 01:03 AM
HTA's secure? BS!

(edited) is a tool which allows ANY file to be encoded and then embedded in plain HTML web page code as a script which will execute automatically by making use of the Hypertext Application (HTA) functions of the Microsoft Windows Scripting Host (WSH) which is called by a script embedded along with the encoded content inside that web page. It is not necessary to click on any link. The mere presence of the script in the page will automatically activate and execute (edited) which will then save the exploit to the computer's hard drive as an HTA file. This exploit was described previously by Georgi Guninski ("scriptlet exploit") but this represents the first time an automatic generator has been released along with all of the necessary source code to permit others to exploit further.


Besides, I've used this trick on a few of my sites. Never had any complaints. The Chromeless window trick is also a bug in IE - you gonna want to remove that feature from all the different sites that use it, too?

07-12-2002, 01:24 AM
that's a rather moot point you make. The fact that neither HTAs nor embedded objects are in any way a good answer to this problem, is another excellent reason to give up on this. It can't be done without circumventing important security measures in some way, which ought to suggest that it shouldn't be done.

Soldier Bob
07-12-2002, 03:31 PM
Unfortunatly some features would require too specific coding to make them secure. Though I dont disagree that popping up a window in any location on the users screen would be a nice feature, seeing some of the more destructive things that can be done currently with the browsers, it isnt worth fighting for.

The web content (HTML) was meant to be accessed from a device. Not necessarly a PC. And since all devices can be different we loose the exactness of certain features.

People are just going to have to get used to what a computer is and isnt. I dont see how loading a web browser isnt ok.

I would think about what your are attempting to do and ask yourself if there isnt another way. XML stands to be the fundamental in which we can have content displayed through any viewer. If you need a client based access to documents, I would strongly suggest looking into what can display XML and how its displayed. See if you cannot do the manipulations to that program and have it also transulate to HTML. If this seems like too much work, then you probably didnt need it done this way in the first place.

In the end "Its a web browser". You dont control the browser, you control the content displayed in the browser. And this is the way it should stay and most likely will stay.

To allow one to change the position, open new windows, and change the look, disorient the users and causes frustration. The best sites shouldnt need to rely on any change to the browser.

-S. Bob

07-12-2002, 04:51 PM
Above Quiet Storm posted the code to get a window to pop up from a link on the desktop w/o toobars, etc.

Given that, does it really matter if the window is centered or not? All my follow up question was was how to center the silly thing. Surely that isn't a security risk!

Now, can someone help me center the popup?