Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to load window.open('url') once only PHP & JQuery

My problem right now is the page is loading like a loop. it is popping pages non-stop , how can I load only once after i trigger the time <= 0 ? thank you.

here is what my code looks like.

<script type="text/javascript">
  var timeleft = 10;
  var downloadTimer = setInterval(function(){
  document.getElementById("progressBar").value = 10 - timeleft;
  timeleft -= 1;

if(timeleft <= 0)

    clearInterval(downloadTimer);
    window.open("http://localhost/ppa/movies.php", "", "width=1500px,height=1000px",true);
  }, 1000);

</script>

1 Answers

I guess you forgot some {}'s and meant to write:

{
    ...
    if (timeleft <= 0) {
        clearInterval(downloadTimer);
        window.open("http://localhost/ppa/movies.php", "",
                    "width=1500px,height=1000px",true);
    }
}, 1000);
like image 122
Stefan Becker Avatar answered Apr 27 '26 11:04

Stefan Becker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!