Welcome Guest, Not a member yet? Register   Sign In
Closing the page after downloading

[eluser]New One[/eluser]
Hello All,

I want mi code to do this:
after pressig download - the download screen appears and in the same time previous window is closing.

function download(){
$basePath = 'c:/';
$data = file_get_contents("$basePath/instructions.txt");
$name = "instructions.txt";
force_download($name, $data);


function GoClose()

<?=form_open('/test/download/', $data)?>
<?echo '<input type="image" name="submit" onmousedown = "GoClose()" src="/images/down.png" />';?>

Something like this. Can someone help me?

[eluser]Code Arachn!d[/eluser]
if you are using the download helper - it should take care of pushing the download window to the browser. So my recommendation is using JavaScript to close any windows you have open. Placing this in a link tag should be what you're looking for:

[eluser]New One[/eluser]
Thanks, Sad But it does not helps. Now window closes before pushing the download window to the browser. So window closes and nothing happens.

[eluser]Code Arachn!d[/eluser]
well unless you have a way of telling if the download is successful then it wouldn't make sense to close the window... one way to try (I'm not 100% if this will even work) is to use this after the force_download
and have the close_page have js code that will close the window.

Theme © iAndrew 2016 - Forum software by © MyBB