View Full Version : Click to Close
Blank Verse
March 24th, 2002, 04:40
I've got on my page the classic "click-the-image-to-close-the-browser-thingy". My problem is, when I click the image, it tells me this:
"the web page you are trying to visit is trying to close the window
do you want to close the window?"
See, now if I click OK, it'll close the window, no problem. But I don't want that prompt coming up, what do I do to prevent this?
This is the code:
<form>
<img src="close.jpg" onClick="window.close()">
</form>
any ideas?
Bruce
March 24th, 2002, 09:07
You can't close a window with javascript unless the window was opened with javascript.
If you try to, you'll see the message you posted. I don't know of any other work-arounds.
Dusty
March 24th, 2002, 10:29
It prompts if there's more than one location in the history. If you want to override the prompt, clear the window's history.
meow
March 24th, 2002, 13:09
Ha! That actually worked but only in Netscape. Never noticed that before.
Dusty
March 24th, 2002, 15:36
Ha! That actually workedWhat, did you think I made it up? :)
meow
March 24th, 2002, 15:47
No, just surprized since I've never heard it before. The use is a little limited if it's only Netscape that handles it that way though.
Blank Verse
March 24th, 2002, 16:35
Originally posted by Bruce
You can't close a window with javascript unless the window was opened with javascript.
If you try to, you'll see the message you posted. I don't know of any other work-arounds.
Actually, this works out well, cause I'm going to have it open through javascript.
meow
March 24th, 2002, 17:20
Then what are you whining about? :p
Blank Verse
March 25th, 2002, 01:54
well, cause when I was testing it, I was just opening it through the URL, I hadn't tried opening it yet with the code I was gonna use to open the browser.
anhedonia
March 25th, 2002, 05:24
Originally posted by meow
Then what are you whining about? :p
He's Canadian, what do you expect? :p
meow
March 25th, 2002, 05:28
Duh. Dumb. :(
Blank Verse
March 25th, 2002, 16:39
Originally posted by +chips
He's Canadian, what do you expect? :p
As soon as I finish my beer and donut, and once I turn off the hockey game, I'll comment to that, eh?
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.