dustbuster
dustbuster

Reputation: 82152

How do i print a message to screen before a php redirect?

I need to print "Your download will begin in a moment" after a POST submit, right before you are redirected the download.

I do not have control over the file where the actual download occurs.

I tried to put an: echo 'Your download will begin in a moment'; right before the header("Location: https://download_example/index?xxxx=xxx"), but it just doesn't work. If you put anything after, well you're already redirected, nothing happens either.

This is in PHP!

Thank you! I've seen this before, i know it's possible!

Upvotes: 0

Views: 60

Answers (1)

Jayant Pandey
Jayant Pandey

Reputation: 110

you can use setTimeout function of javascript. for example

setTimeout(function(){
  window.location.href = "www.example.com"
},2000); // 2 second

Upvotes: 1

Related Questions