Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Countdown Till Redirect
sxyloverboy
post Dec 6 2005, 07:18 PM
Post #1


Super Member
*********

Group: Members
Posts: 302
Joined: 17-June 05
From: Frankfurt, Germany
Member No.: 8,358



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
Go to the top of the page
 
+Quote Post
rvalkass
post Dec 6 2005, 08:11 PM
Post #2


apt-get moo
Group Icon

Group: [MODERATOR]
Posts: 2,114
Joined: 28-May 05
From: Hertfordshire, England
Member No.: 7,593
Spam Patrol



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
Go to the top of the page
 
+Quote Post
sxyloverboy
post Dec 6 2005, 09:13 PM
Post #3


Super Member
*********

Group: Members
Posts: 302
Joined: 17-June 05
From: Frankfurt, Germany
Member No.: 8,358



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?
Go to the top of the page
 
+Quote Post
switch
post Dec 6 2005, 10:34 PM
Post #4


Premium Member
********

Group: Members
Posts: 178
Joined: 13-October 04
From: NSW, Australia
Member No.: 1,713



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.
Go to the top of the page
 
+Quote Post
peroim
post Jul 11 2006, 10:50 AM
Post #5


Newbie [Level 2]
**

Group: Members
Posts: 33
Joined: 9-July 06
From: Belgium
Member No.: 26,367



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>


This post has been edited by peroim: Jul 11 2006, 10:56 AM
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Redirect Code Help(8)
  2. Redirect Problem(6)
  3. How To Redirect(5)


 



- Lo-Fi Version Time is now: 7th September 2008 - 03:32 AM