IT CAMPER
asked on
Need auto-redirect to auto open a new window instead of refreshing the current window
Here is the current script I use to redirect after a certain period of time. It is used to open a PDF file, but if the computer is configured to open the PDF files inside of the browser instead of prompting the user to open or save them it opens inside of the original window which is not good.
I need this script to open the pdf in a new window after the 5 second timeout.
<META HTTP-EQUIV="refresh" CONTENT="5;URL=http://www.mysite.com/quick_start_guide.pdf">
I need this script to open the pdf in a new window after the 5 second timeout.
<META HTTP-EQUIV="refresh" CONTENT="5;URL=http://www.mysite.com/quick_start_guide.pdf">
do u want the pdf to open in a new window? OR give the user the option of choosing to open / save the file?
Found this in another Q coustesy elisch;
you need to use javascript
========================== =====
<script language="javascript">
<!-- Begin
redirTime = "2000";
function redirTimer() {
window.open("http://www.cnn.com","cnn",heigh t="400",wi dth="400", toolbar="n o",scrollb ars="yes", resizable= "no",menub ar="no");
self.setTimeout(self.locat ion.href = "http://www.microsoft.com")}
//END Script-->
</script>
<body onLoad="redirTimer();">
</body>
you need to use javascript
==========================
<script language="javascript">
<!-- Begin
redirTime = "2000";
function redirTimer() {
window.open("http://www.cnn.com","cnn",heigh
self.setTimeout(self.locat
//END Script-->
</script>
<body onLoad="redirTimer();">
</body>
https://www.experts-exchange.com/questions/21152663/Intro-page-redirection.html
take a look at my javascript example in that post. just change the location.replace( "url goes here" ); to window.open
take a look at my javascript example in that post. just change the location.replace( "url goes here" ); to window.open
and of course change the time to what you want ( 5 seconds would be 5000 miliseconds )
ASKER
before I try either of the solutions provided, let me add that I am using a body onunload statement to redirect the visitor once they close the window so I need a solution that will atuo open the PDF files (that answers your question VirusMinus) in that I want the PDF to open instead of prompting them of choice. At the same time, I need a solution that will not interfere with the onunload statement, which I think the onload statement will cause the onunload to fire as well.
What do you guys think? I will work with the solutions while you ponder that thought.
What do you guys think? I will work with the solutions while you ponder that thought.
onload() will not cause onunload() to trigger i don't think..
ASKER
VirusMinus, the reDire timer does not wait the set period of time before opening the PDF file. As soon as the page loads it fires the PDF even if I set the timer to 30 seconds for an extreme test. Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
that did it, thanks again
ASKER
points increased to 250 due to difficulty
thanks murryc, glad to be of help
VM
VM