...

View Full Version : Close window without alert?



javaspace
04-04-2003, 02:42 PM
Hi:

I have link in my page when clicked it's supposed to close the window. The window is in a frame :

<frameset rows="72,*" frameborder="NO" border="0" framespacing="0" cols="*">
<frame name="topFrame" scrolling="NO" src="topbannerportal.asp?Loggedin=true">
<frame name="mainFrame" src="door.asp">

</frameset>

Now how can I close the window. I have a link in the top frame src page like this:
<a href="javascript:document.close();" > <font Color = "black"> <B> LogOff </B> </FONT> </a>

But when I click on the link it does nothing. Can I close the window without the alert window popup asking yes or no to close the window.

Can some please help.

Thanks for you help in advnace

Borgtex
04-04-2003, 06:34 PM
something like this could work:

self.opener = top;self.close()

but not in all browsers, however

liorean
04-04-2003, 06:51 PM
document.close closes a stream opened with document.open. It's window.close you want, that closes a window (ithout prompting only if it's been opened by window.open of the current window)

brothercake
04-04-2003, 07:39 PM
Originally posted by liorean
(without prompting only if it's been opened by window.open of the current window)
yes, but using self.opener = top; bypasses the warning in IE and just closes it.

Grmph. I don't approve :(

liorean
04-04-2003, 08:00 PM
How utterly ridiculus - you shouldn't be able to overwrite window.opener or anything else that describes factual information. What if we allowed overwriting of other properties, like document.referrer, navigator.mimeTypes or screen.availWidth?

brothercake
04-04-2003, 08:04 PM
Originally posted by liorean
How utterly ridiculus - you shouldn't be able to overwrite window.opener or anything else that describes factual information. What if we allowed overwriting of other properties, like document.referrer, navigator.mimeTypes or screen.availWidth?
Just don't get me started :rolleyes:

Mr J
04-05-2003, 12:18 AM
A way round this is to add the following to a function

window.opener = top;
window.close()

:thumbsup:

Borgtex
04-05-2003, 10:07 AM
Originally posted by Mr J
A way round this is to add the following to a function

window.opener = top;
window.close()

:thumbsup:


lol, seems that somebody has not read the previous posts :D :D

Mr J
04-05-2003, 10:22 AM
lol, seems that somebody has not read the previous posts

On the contrary, but it appears no one was getting anywhere other than debate the issue


:D

charliek
05-01-2003, 12:05 AM
I don't want to enter the debate but just want clarification, please.

Only when the window was opened outside of JavaScript, window.close() was producing the alert in IE running on XP most of the time, but never in IE running on ME. I was trying to get rid of the alert as well, so I tried

self.opener = top;self.close()

which Borgtex suggested and it seems to work, on IE/XP in that no alert comes up.

then, I read further into the thread and found some disapproved, but didn't understand why. Even Borgtex said "but not in all browsers, however"

I just want to know if there is a risk of this thing not working on some browser/OS combo.

if not, it seems to solve my difficulty with the alert, which is a bother. I have written an application where I prefer it closed.

thanks
charliek



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum