Click to See Complete Forum and Search --> : Close Window That Has No Opener?


robindean
07-15-2008, 02:59 PM
My e-mailing list sends out a confirm message. The person clicks the link in their email (from, let's say, an email client rather than webmail).

The link opens their browser and a "subscription confirmed" message appears.

I want a link that says "Close Window".

I've tried onclick="self.close();" ... didn't work.

Nor did "window.close():"

How do I do this?

FrankTheTank
07-15-2008, 03:04 PM
Looks like you made a typo...?

try window.close();

Frank

rnd me
07-15-2008, 04:04 PM
self === window

perhaps you can't. its a user pref in Firefox, disabled by default.

not sure about others...

robindean
07-15-2008, 04:26 PM
Yeah, I meant to type window.close(); which is what I tried in my document.

Neither works and I suppose it can't be done. Ah well, no big deal I suppose.

Thanks for the help.

eCat
07-15-2008, 04:40 PM
You want a button or a link?


<form>
<input type=button value="Close Window" onClick="javascript:window.close();">
</form>


<a href="javascript:window.close();">Close Window</a>

toicontien
07-15-2008, 05:00 PM
As a general rule, JavaScript is not allowed to close a window it didn't spawn in the first place. I wonder perhaps if you are running into this snag?

robindean
07-15-2008, 06:00 PM
Yep. That's the snag.

Kor
07-16-2008, 03:51 AM
There is no way to close a window using javascript methods if the window was not opened via a javascript method (if it is not a popup).