PDA

View Full Version : How would you code this? (meta redirect)


Dribbles
08-12-2009, 06:53 PM
I know you can do an autoredirect this way:

<META
http-equiv="refresh"
content="10;URL=http://www.******.com/forum/quiz_comics_v1">

but instead of just directing to 1 url, is there a way to have it auto-redirect to a random url out of a list of 10 url's? Like the person clicks the quiz page and it randomly picks a url from:

http://www.******.com/forum/quiz_comics_v1
http://www.******.com/forum/quiz_comics_v2
http://www.******.com/forum/quiz_comics_v3
http://www.******.com/forum/quiz_comics_v4
http://www.******.com/forum/quiz_comics_v5
http://www.******.com/forum/quiz_comics_v6
http://www.******.com/forum/quiz_comics_v7
http://www.******.com/forum/quiz_comics_v8
http://www.******.com/forum/quiz_comics_v9
http://www.******.com/forum/quiz_comics_v10

UKBusinessLive
08-12-2009, 07:09 PM
I know you can do an autoredirect this way:

<META
http-equiv="refresh"
content="10;URL=http://www.******.com/forum/quiz_comics_v1">

but instead of just directing to 1 url, is there a way to have it auto-redirect to a random url out of a list of 10 url's? Like the person clicks the quiz page and it randomly picks a url from:

http://www.******.com/forum/quiz_comics_v1
http://www.******.com/forum/quiz_comics_v2
http://www.******.com/forum/quiz_comics_v3
http://www.******.com/forum/quiz_comics_v4
http://www.******.com/forum/quiz_comics_v5
http://www.******.com/forum/quiz_comics_v6
http://www.******.com/forum/quiz_comics_v7
http://www.******.com/forum/quiz_comics_v8
http://www.******.com/forum/quiz_comics_v9
http://www.******.com/forum/quiz_comics_v10

Hi Dribbles,

Not sure how to do it with the meta refresh, but with javascript its pretty easy

<script type="text/javascript">

var urls = new Array("http://www.******.com/forum/quiz_comics_v1/", "http://www.******.com/forum/quiz_comics_v2/");

function redirect()
{
window.location = urls[Math.floor(urls.length*Math.random())];
}

var temp = setInterval("redirect()", 3000);

</script>

Just enter the Urls in the

var urls = new Array

Inside the brackets add your urls

Go to here

var temp = setInterval("redirect()", 3000);

and change the 3000 value (Milliseconds) to more or less remember 1000 milliseconds is 1 second ;)

;)

Dribbles
08-12-2009, 07:11 PM
thanks!! So I put this in the header area?

UKBusinessLive
08-12-2009, 08:01 PM
thanks!! So I put this in the header area?

Please, Try at the end of your header ;)

let us know if it worked ;)

Stagehandspace
08-13-2009, 01:57 AM
Please, Try at the end of your header ;)

let us know if it worked ;)

Top of "headinclude" template would be best for this sort of coding as its meta related.

UKBusinessLive
08-13-2009, 05:38 PM
Top of "headinclude" template would be best for this sort of coding as its meta related.

Thanks for the heads up ;)