Two headers for different url's in the same page (PHP) -
i want to, once user has arrived page, first, download item using script , then, redirect him or index.
so have following code:
$filename = $_get["file"]; $down = 'components/com_djclassifieds/views/item/tmpl/download.php?file='.$filename; header( "refresh:2;url=$down" ); header( "refresh:5;url=index.php" );
and, example, following url:
http://my.web.com/index.php?option=com_k2&view=item&layout=item&id=39&file=test.pdf
but not working. tried use 'location' in code:
$filename = $_get["file"]; header('location: http://'.$_server['http_host'].str_replace(basename($_server['php_self']), '', $_server['php_self']).'/components/com_djclassifieds/views/item/tmpl/download.php?file='.$filename); exit; header( "refresh:5;url=index.php" );
and downloads file after not redirect me index.
what doing wrong?
don't bother php. can jquery.
html:
<script src="code.jquery.com/jquery.min.js"></script> <div style='display:none;' id="div"></div> <script> var iframe = $("<iframe/>").attr({ src: "http://example.com/path/file.extension" }).appendto($("#div")); window.location="http://example.com/path/redirect.html" </script>
Comments
Post a Comment