PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : aktuelles Fenster schliessen fuer Mozilla


Usul
04.09.2004, 13:58:03
hallo,

wie schaffe ich es per Javascript das aktuelle Fenster zu schliessen, so das es auch bei Mozilla funzt?

folgendes geht nicht:

close()
window.close()
top.close()



danke,

Usul

xabbuh
04.09.2004, 14:09:40
self.close() ?

Ist JavaScript denn überhaupt bei dir im Mozilla aktiviert?

Usul
04.09.2004, 20:42:49
ja, glaub mir solche fehler mache ich schon lange nicht mehr.

also folgendes funzt nicht mit mozilla:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>quit</TITLE>
</HEAD>

<BODY>

<a href="javascript:self.close();">quit</a>

</BODY>
</HTML>


was muss man also aendern, damits auch bei mozilla funzt?

xabbuh
05.09.2004, 12:33:29
Das sieht meiner Meinung nach so ganz gut aus.
Welcher Mozilla Version nutzt du denn?
Hast du mal das Beispiel von Selfhtml (http://de.selfhtml.org/javascript/objekte/window.htm#close) dazu ausprobiert?

Gweilo
05.09.2004, 12:55:55
google ist dein bester freund: http://www.webmasterworld.com/forum21/5935.htm

edit: webmasterworld mag den referrer selfphp wohl nicht ;c) hier ein ausschnitt:


I don't think it's possible. Try it then have a look at the javascript Console (Tools > Web Development)

Scripts may not close windows that were not opened by script.

I think you'd have to first open the parent from another window.



The script below closes a parent window, even if it hasn't been popped using javascript.

However, although it works fine in Netscape v7, I find that it works erratically in IE6. It always shuts down the parent window, but often opens up multiple copies of the pop-up window. At least it does, when used in conjunction with my standard openpopup function.

If you can find the answer, I would be interested to hear from you. Note: index.htm is the name of the parent window.

[In child window]

if (!opener.closed && opener.location){
opener.location.href="index.htm";
opener.opener = top
opener.parent.window.close();
}

[In parent window]

function openpopup(){
var popurl="mainmenu.htm"
winpops=window.open(popurl,"","toolbar=no,location=no,directories=no,status=no,*
menubar=no,scrollbars=no,resizable=yes,copyhistory=yes,width=748,heigh t=400")
}