I have a page with the following:
<script>
window.setInterval(function () {
var cookie = $.cookie('download');
if (cookie !== null) {
console.log(cookie);
}
}, 500);
</script>
It is checking a cookie
called download and its value of 0 (previously set) is being displayed in the console.
From this page I can click a button which launches a php pdf generating file and just before the pdf is output (to download the pdf) have:
<?php
... pdf created ...
setcookie("download", 1);
output pdf;
?>
suposedly to mark set the cookie
as 1 to indicate the download is complete. However this change is not reflected in the console and the cookie
remains with the value 0.
Is what I am trying to do possible? And if so what am I doing wrong?
This method is proposed with this question: Is there any event/way we can know when a file has finished downloading?