page should be redirected after the download starts, but I have the code like whether the download start or not, it is redirecting after the setTimeout. Is there any solution so that we can write a condition like after download start or complete , we can redirect to desired page. Thanks in advance..
<?php
while($row1=mysql_fetch_array($result))
{
$name=$row1['name'];
$type=$row1['type'];
?>
<div class="rect" id="d1">
<img alt="down-icon" src="down-drop-icon.png" align="left" width="20" height="20" />
<a href="download.php?filename=<?php echo $name ;?>" >
<?php echo $name ;?></a>
<script type="text/javascript">
var howLongToWait = 15; //number of seconds to wait
var urlOfRedirectLocation = 'http://gomasti.in/p/gomasti/';
function startRedirect() {
window.top.location.href = urlOfRedirectLocation;
}
setTimeout('startRedirect()', howLongToWait * 1000);
</script>
</div>
<?php }?>