[thelist] Javascript:self.close() w/out Warning

.jeff jeff at members.evolt.org
Wed Jan 29 18:41:01 CST 2003


rob,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Rob Smith
>
> Is there a way to close the browser window with
> Javascript that doesn't prompt the user?
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

yes.  if it's opened from javascript then it's simple.  if it wasn't opened
from javascript then it's alittle more difficult.

<tip type="JavaScript" author=".jeff">

have a window that isn't created with javascript that you want to close and
you don't wanna have the user see that annoying dialog?  well, it's as
simple as assigning the current window object to the opener property of the
window.  then you can close it with no dialog.

<script language="JavaScript" type="text/javascript">
<!--
  window.opener = self;
  window.close();
// -->
</script>

</tip>

good luck,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/




More information about the thelist mailing list