Click here to Skip to main content
15,891,926 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how can i set a timer for a pdf file open in a browser tab

What I have tried:

i have tried so many methods,they coudnt work out
Posted
Updated 1-Jan-17 6:45am

1 solution

You shouldn't do this in your ASP.NET code, because that runs on the server. This case is better handled client-side, using JavaScript. JavaScript has a setTimeout function[^] which you can use to run a function after a certain amount of time. In this function, you can redirect the user to a PDF file.
JavaScript
setTimeout(function() {
    window.location = "/path/to/your/file.pdf";
}, 5000); // 5000 milliseconds = 5 seconds. Adjust if necessary.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900