K
kevinm3574
So, I'm doing the following in a php script so that I can fire a
download dialogue AND redirect the page (after clicking submit in a
form). I'm doing it this way because of the problem with headers and
such and server-side vs client-side issues:
$dir = "somedir";
$file = "somefile";
print("
<script language=\"JavaScript\">
<!--
my_window =
window.open('get.php?dir=packages$dir&file=$file','Downloading','width=1,height=1,resize=no');
window.location.href = '$redirpage';
setTimeout('window.close()', 5000);
//-->
</script>");
Everything works here EXCEPT for the closing of the d**n empty window
that is opened. My get.php fires to open a new dialogue to download
the file I want, the page I was on gets redirected to $redirpage, but
the empty window doesn't close. If I DON'T use setTimeout and just do
the following:
print("
<script language=\"JavaScript\">
<!--
my_window =
window.open('get.php?dir=packages$dir&file=$file','Downloading','width=1,height=1,resize=no');
window.location.href = '$redirpage';
my_window.close();
//-->
</script>");
then the window closes but too fast for the get.php to pop up the
download dialogue (hence my need to delay the close of the window a
bit). I've tried using setTimeout('my_window.close()', 5000); but the
empty window never closes. This is driving me nuts as it appears it
should be fairly straight forward. Any assistance is greatly
appreciated. (BTW, I'm fairly novice at this so any better ideas on how
to do what I'm trying to do is also greatly appreciated).
Thanks.
Kevin
download dialogue AND redirect the page (after clicking submit in a
form). I'm doing it this way because of the problem with headers and
such and server-side vs client-side issues:
$dir = "somedir";
$file = "somefile";
print("
<script language=\"JavaScript\">
<!--
my_window =
window.open('get.php?dir=packages$dir&file=$file','Downloading','width=1,height=1,resize=no');
window.location.href = '$redirpage';
setTimeout('window.close()', 5000);
//-->
</script>");
Everything works here EXCEPT for the closing of the d**n empty window
that is opened. My get.php fires to open a new dialogue to download
the file I want, the page I was on gets redirected to $redirpage, but
the empty window doesn't close. If I DON'T use setTimeout and just do
the following:
print("
<script language=\"JavaScript\">
<!--
my_window =
window.open('get.php?dir=packages$dir&file=$file','Downloading','width=1,height=1,resize=no');
window.location.href = '$redirpage';
my_window.close();
//-->
</script>");
then the window closes but too fast for the get.php to pop up the
download dialogue (hence my need to delay the close of the window a
bit). I've tried using setTimeout('my_window.close()', 5000); but the
empty window never closes. This is driving me nuts as it appears it
should be fairly straight forward. Any assistance is greatly
appreciated. (BTW, I'm fairly novice at this so any better ideas on how
to do what I'm trying to do is also greatly appreciated).
Thanks.
Kevin