anyone knows the command to close the window?
would
Code: Select all
echo "self.close()";be correct?
if not, please tell me what i have left out with a counter example
- hanhao
Moderator: General Moderators
Code: Select all
echo "self.close()";Again - you'll need JavaScript for thathanhao wrote:ok i need to self close a window (like after 5 seconds)
anyone knows the command to close the window?
would
?Code: Select all
echo "self.close()";
be correct?
if not, please tell me what i have left out with a counter example
- hanhao
Code: Select all
<body onLoad="setTimeout(window.close, 5000)">Although that might work to some degree in IE it is not legal code and will be stopped by the sandbox in the Gecko browsers (and rightly so). The only window that may command the closure of a window is the one that opened it. Since a window cannot magically open itself code such as this is not ever going to work properly.aerodromoi wrote:aerodromoiCode: Select all
<body onLoad="setTimeout(window.close, 5000)">
So it would be something along that line:bokehman wrote:Although that might work to some degree in IE it is not legal code and will be stopped by the sandbox in the Gecko browsers (and rightly so). The only window that may command the closure of a window is the one that opened it. Since a window cannot magically open itself code such as this is not ever going to work properly.
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript">
var popupvar;
function openpopup(){
popupvar = window.open("http://www.google.com/", "Google","menubar=yes");
}
function closepopup(){
popupvar.close();
}
</script>
</head>
<body onLoad="openpopup(); setTimeout(closepopup(), 5000);">
</body>
</html>