Jul 26, 2008

Countdown Till Redirect

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > HTML, XML etc..

free web hosting

Countdown Till Redirect

sxyloverboy
ok here is a question:

how would i do something that says you will be redirected in 15 seconds and then changes the number till the redirection takes place.
this is planned for a custom 404 error page.

im not just asking for the countdown but also how to redirect at all.

thankfull for any help smile.gif

Lucas

Reply

rvalkass
This should do something similar to what you need. Simply cut and paste it and change the few settings.

http://javascriptkit.com/script/script2/countredirect.shtml

Reply

sxyloverboy
yeah thats pretty much what i mean. but i dont really like the form thing that shows the number? is there maybe a way to get a number that looks like its in the text?

Reply

switch
well, there's a bare-bones html way of redirecting, but you can't display the seconds remaining or anything with it. what you basically do is add this in between the <HEAD> tags.

CODE
<meta http-equiv="REFRESH" content="time; URL=your.url">


where time is an integer representing number of seconds until redirect, and your.url is the url that you wish to redirect to.

also www.billstclair.com/html-redirect2.html notes that
QUOTE
It is customary to include a direct link to the page that will be switched to automatically in case you get an older browser that doesn't support the feature or the user doesn't want to wait.


i know that there is a way of using a java applet to countdown to 0 and then redirect, but you probably wouldn't want an applet on a 404 error page smile.gif
javascript is probably the way to go for that (although it can be easily disabled- so that's another consideration).

all in all, HTML redirection is probably the most compatible way to do it, and, although it can't do anything really flashy, it gets the job done no problems.

all the best.

 

 

 


Reply

peroim
if you really want it in HTML and java script:

Insert this in the HEAD of you page:
CODE
<script language='JavaScript'>
var time = 15; //How long (in seconds) to countdown
var page = "yourpage.htm"; //The page to redirect to
function countDown(){
time--;
gett("container").innerHTML = time;
if(time == -1){
window.location = page;
}
}
function gett(id){
if(document.getElementById) return document.getElementById(id);
if(document.all) return document.all.id;
if(document.layers) return document.layers.id;
if(window.opera) return window.opera.id;
}
function init(){
if(gett('container')){
setInterval(countDown, 1000);
gett("container").innerHTML = time;
}
else{
setTimeout(init, 50);
}
}
document.onload = init();
</SCRIPT>


And this in the body of the page (where you want the countdown to appear):
CODE
<span id='container'></span>

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. redirect countdown - 15.97 hr back. (1)
  2. javascript countdown redirect - 20.23 hr back. (3)
  3. url redirect javascript with countdown - 22.81 hr back. (1)
  4. timer redirection php - 23.01 hr back. (1)
  5. redirect countdown timer javascript - 23.21 hr back. (1)
  6. "javascript" "countdown" redirect - 29.96 hr back. (1)
  7. http-equiv="refresh" countdown - 32.97 hr back. (1)
  8. countdown then redirect html - 37.85 hr back. (3)
  9. redirecting count down timer html - 41.05 hr back. (1)
  10. redirect countdown script - 47.45 hr back. (1)
  11. countdown redirect - 48.86 hr back. (2)
  12. javascript confirm function when countdown - 54.62 hr back. (1)
  13. redirecting in 5 seconds php with countdown - 61.64 hr back. (1)
  14. redirect page countdown - 66.20 hr back. (1)
Similar Topics

Keywords : countdown, redirect

  1. How To Redirect
    Not as simple as it sounds (5)
  2. Redirect Problem
    (6)
    Hi, does anyone know if there is a way to display say www.b.com at www.a.com without using redirect
    from a to b. The real problem i have is if you try going to www.frusciante.net you will get
    redirected to www.locborg.de/fru where the files are stored. The code in frusciante.net is: HTML
    FRAMESET border=0 frameSpacing=0 rows=100%,* frameBorder=0 > FRAME name=bannerframe src ="
    http://www.locborg.de/fru/ " noResize> /FRAMESET > So is there a way to display the files
    from locborg.de/fru while maintaining the frusciante.net URL in the browser?....
  3. 301 Redirect And Bots
    a small doubt (6)
    Hi guys, I am presently developing a website which depends on JavaScript for its design. The
    problem is that some browsers do not JavaScript enabled. So, in case Script cannot be run on the
    browser, I have given a 301 (Meta) Redirect to a page which will tell them to enable the script.
    What about the Search engine bots? Will they undergo the 301 Redirect? Or can they see the
    actual page? Please help. ....
  4. Url Redirection = Javascript+html
    Redirect using scripts! (4)
    In javascript Browser redirection can be done in 3 ways: 1) Alert Redirect: CODE
    <html> <script>     alert("This page has been moved to a new location...
    click OK to be redirected.");     location = "http://www.your-website.com";
    </script> </html> 2) Confirm and Redirect: CODE <html>
    <script>     if(confirm("This page has been moved to a new location... would you
    like to be redirected"))     {   location = "http://www.your-website.com";
        }....
  5. Redirect Code Help
    (8)
    Can someone give me the code which redirects you automatically in the whole page instead of only in
    the frame? I'm using this code, but it just redirects inside a frame... CODE <meta
    HTTP-EQUIV="REFRESH" content="0; url=http://www.something.com"> But now
    .tk has added a ad to the pages so I don't want to use it anymore, so I want that people
    entering the site is being redirected to the "real" domain name now.......

    1. Looking for countdown, redirect

Searching Video's for countdown, redirect
advertisement



Countdown Till Redirect



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE