Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

self.location problem

Posted on 2007-08-11
4
Medium Priority
?
668 Views
Last Modified: 2012-06-27
I have a web title page that I display for 5 seconds and then re-direct using the following code:

redirtime = "5000";
redirurl = "https://www.mypage.ca/main.asp";
function redirtimer()
{
self.setTimeout("self.location.href = redirurl;",redirtime);
}

When I had Windows XP everything worked fine.  Now that I have Vista, when it re-directs, it leaves the original page open and opens a new page for "main.asp".  I only want one page.

Is there a solution for this problem?
0
Comment
Question by:deross
  • 2
4 Comments
 
LVL 11

Expert Comment

by:BraveBrain
ID: 19676240
Try this:
function redirtimer()
{
setTimeout("location.href = redirurl;",redirtime);
}
0
 

Author Comment

by:deross
ID: 19677555
This didn't work.
0
 
LVL 17

Expert Comment

by:BogoJoker
ID: 19678196
Here my function is similiar to BraveBrain's in that I use setTimeout and window.location.href (notice I explicitly used window).  I added 'var' to the variable declarations, and I made them local variables to make my example concise.  This worked just fine in Firefox 2.0 on my Mac.

function redirtimer() {
  var redirtime = 5000;
  var redirurl = 'https://www.mypage.ca/main.asp';
  setTimeout( 'window.location.href = redirurl;', redirtime);
}

If this doesn't work I would like to help some more but I would need the answer to these questions:
1) What browser are you using?
2) In what context and how do you make the call to your redirtimer function?
3) Are you sure that the URL is correct?

I think that should work though,
- Joe P
0
 
LVL 11

Accepted Solution

by:
BraveBrain earned 1500 total points
ID: 19679122
I'll add another question to those ;)

4) Is there any particular reason you don't use a meta refresh?
If no, the syntax would then be
<meta http-equiv="Refresh" content="5; URL=https://www.mypage.ca/main.asp" />
in the head section of your page.
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

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

This article discusses how to implement server side field validation and display customized error messages to the client.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…

571 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