Solved

Need auto-redirect to auto open a new window instead of refreshing the current window

Posted on 2004-10-08
11
228 Views
Last Modified: 2011-09-20
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">
0
Comment
Question by:murryc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
11 Comments
 
LVL 30

Expert Comment

by:VirusMinus
ID: 12260945
do u want the pdf to open in a new window? OR give the user the option of choosing to open / save the file?
0
 
LVL 30

Expert Comment

by:VirusMinus
ID: 12260975
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",height="400",width="400",toolbar="no",scrollbars="yes",resizable="no",menubar="no");

    self.setTimeout(self.location.href = "http://www.microsoft.com")}

//END Script-->
</script>


<body onLoad="redirTimer();">

</body>
0
 
LVL 15

Expert Comment

by:justinbillig
ID: 12261096
http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_21152663.html

take a look at my javascript example in that post. just change the location.replace( "url goes here" ); to window.open
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:justinbillig
ID: 12261104
and of course change the time to what you want ( 5 seconds would be 5000 miliseconds )
0
 

Author Comment

by:murryc
ID: 12262109
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.
0
 
LVL 30

Expert Comment

by:VirusMinus
ID: 12265087
onload() will not cause onunload() to trigger i don't think..
0
 

Author Comment

by:murryc
ID: 12298116
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?
0
 
LVL 30

Accepted Solution

by:
VirusMinus earned 250 total points
ID: 12304727
try this -> i tested it..

<html>
<head>
<script language="javascript">
<!-- Begin
function redirTimer() {
    window.open("http://www.cnn.com","cnn",height="400",width="400",toolbar="no",scrollbars="yes",resizable="no",menubar="no");
    //setTimeout(window.open("http://www.cnn.com","cnn",height="400",width="400",toolbar="no",scrollbars="yes",resizable="no",menubar="no"), redirTime);
      }
//END Script-->
</script>
</head>

<body onload="setTimeout('redirTimer()', 5000)">
wait 5 seconds...
</body>
</html>
0
 

Author Comment

by:murryc
ID: 12304973
that did it, thanks again
0
 

Author Comment

by:murryc
ID: 12304976
points increased to 250 due to difficulty
0
 
LVL 30

Expert Comment

by:VirusMinus
ID: 12306240
thanks murryc, glad to be of help

VM
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question