Home > database >  How can I redirect my user after downloaded?
How can I redirect my user after downloaded?

Time:11-23

I'm not sure if I am fighting with something impossible in PHP

I was trying to redirect and download or download and redirect, but either doesn't work.

After the user download the PDF, I want to redirect back to the main page

I've tried

header("Location: https://www.main-page.com");
return Response::download($file,"file.pdf", $headers);

Ex

https://www.main-page.com

https://www.main-page.com/pdf (show download PDF and return back to the main page)

CodePudding user response:

In this case you need to implement a pdf reader inside your webpage then you give your user the way to go backward to the main domain.

CodePudding user response:

you can try this

Response::download($file,"file.pdf", $headers); return redirect("path location you want to redirect");

  • Related