Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-23-2012, 07:52 AM   PM User | #1
Madmagoo
New to the CF scene

 
Join Date: Nov 2012
Location: Australia
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Madmagoo is an unknown quantity at this point
Splash page redirection loop

When creating a splash page and using the html redirection code how is it best to avoid ending in an endless redirection loop?

The page I want to redirect to is the main index page of the site that I am filing the splash page in. and when I set the splash page going it just endlesslly loops onto itself.

I have tried renaming the index.html file but it gave no effect. I amnot sure what else to try. I am guessing there is some other code that I need to write in to bypass this problem but I can't think of it for the life of me.

Code:
<script type="text/javascript">

window.onload=timeout;
function timeout(){
window.setTimeout("redirect()",15000)}

function redirect(){
window.location="name of http link I want to send to"
return}

</script>
That is the redirect code I am using.
Any help would be appreciated, thanks
Madmagoo is offline   Reply With Quote
Old 11-23-2012, 03:20 PM   PM User | #2
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,365
Thanks: 18
Thanked 348 Times in 347 Posts
sunfighter is on a distinguished road
Code:
<html>
<head>
<script type="text/javascript">
function delayer(){
    window.location = "someplace.php"
}
</script>
</head>
<body onLoad="setTimeout('delayer()', 5000)">
<h2>Prepare to be redirected!</h2>
<p>This page is a time delay redirect, please update your bookmarks to our new
location!</p>

</body>
</html>
sunfighter is offline   Reply With Quote
Old 11-23-2012, 03:33 PM   PM User | #3
Redcoder
Regular Coder

 
Redcoder's Avatar
 
Join Date: May 2012
Location: /dev/couch
Posts: 309
Thanks: 2
Thanked 46 Times in 45 Posts
Redcoder has a little shameless behaviour in the past
Try:
PHP Code:
<script type="text/javascript">

window.onload=timeout;
function 
timeout(){
window.setTimeout(redirect,15000)}

function 
redirect()
{
window.location="name of http link I want to send to";

}

</script> 
__________________
For professional Hosting and Web design.....


NetEssentials.co.uk
Redcoder is offline   Reply With Quote
Old 11-23-2012, 03:35 PM   PM User | #4
Redcoder
Regular Coder

 
Redcoder's Avatar
 
Join Date: May 2012
Location: /dev/couch
Posts: 309
Thanks: 2
Thanked 46 Times in 45 Posts
Redcoder has a little shameless behaviour in the past
Although I think that you have used a lot of code where farmuch less code would have sufficed. If you are learning how to use functions, thenuse the above code. But Sunfighter's code is much less than yourapproach.
__________________
For professional Hosting and Web design.....


NetEssentials.co.uk
Redcoder is offline   Reply With Quote
Old 11-23-2012, 10:52 PM   PM User | #5
Madmagoo
New to the CF scene

 
Join Date: Nov 2012
Location: Australia
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Madmagoo is an unknown quantity at this point
I appreciate the options but I am still getting the loop.

I tried various combinations but I just cannot get it to stop looping unless I make the url point to anywhere but the index page.

I have had to use my original code and point my URL to my login page instead of the index but now for some reason it is instantaneously redirecting instead of the 15 second delay although I didn't alter that part of the code.
Madmagoo is offline   Reply With Quote
Old 11-23-2012, 11:12 PM   PM User | #6
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,365
Thanks: 18
Thanked 348 Times in 347 Posts
sunfighter is on a distinguished road
Must be caused by the page your going to. What is it's name?
sunfighter is offline   Reply With Quote
Old 11-23-2012, 11:27 PM   PM User | #7
Redcoder
Regular Coder

 
Redcoder's Avatar
 
Join Date: May 2012
Location: /dev/couch
Posts: 309
Thanks: 2
Thanked 46 Times in 45 Posts
Redcoder has a little shameless behaviour in the past
Or there may be another piece of conflicting code.
__________________
For professional Hosting and Web design.....


NetEssentials.co.uk
Redcoder is offline   Reply With Quote
Old 11-24-2012, 01:56 AM   PM User | #8
Madmagoo
New to the CF scene

 
Join Date: Nov 2012
Location: Australia
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Madmagoo is an unknown quantity at this point
This is the entire code I am using for my page - it is only a basic page for now before I build a better one later as this is a temporary fix while we rebuild the site.

Code:
<html>
<head>
<title>Welcome To site name</title>
<style type="text/CSS">
body {background-color:#9FCFFF;};

</style>
<script type="text/javascript">

window.onload=timeout;
function timeout(){
window.setTimeout(redirect(),15000)}

function redirect(){
window.location="http://www.domainname.com/index.php"

}

</script>

<body onload="timeout()">

</script>

</head>
<body>

<center> <img src="logo01.gif" ></center>
<br>
<br>
<br>
<p><center><h2> Due to ongoing technical difficulties, some users may experience delays or outages with the site name site.</h2></center></p>
<br>
<p><h1><b> <center><font color=#076C9F>SITE NAME IS CURRENTLY BUSINESS AS USUAL!!! </font><b></center></h1></p>
<p><h3><b><center> <font color=#FFFFFF>The sites technical team, (TechTeddy and Snoozz), will be working on the site over the coming days and as a result there may be short periods of downtime.  Please bare with us and keep checking back frequently.   Currently it is business as usual and we hope to have everything 100% as soon as possible.</font></h3><b></center></p>
<br>
<p> <center>If you have any difficulties or questions, please feel free to contact any of the members of the admin team and they will do their best to help you.</center></p>
<p><center><font color=#DE8621> Ros (Stillme) <a href="mailto:email@hotmail.com">Stillme’s email</a> , Bohica <a href="mailto:email@hotmail.com">Bohica’s email</a>  Jo (TechTeddy) <a href="mailto:email@live.com.au">TechTeddy’s email</a> , Snoozz <a href="mailto:email@yahoo.com">Snoozz’s email</a></font></center>
</body>
</html>
When I change the URL to

Code:
window.location="http://www.domainname.com/ucp.php?mode=login"
Like I said, I just get the instant redirect but at least it is redirecting.
Madmagoo is offline   Reply With Quote
Old 11-24-2012, 02:28 PM   PM User | #9
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,365
Thanks: 18
Thanked 348 Times in 347 Posts
sunfighter is on a distinguished road
Madmagoo I just have this gut feeling that the problem is the name of the page your redirecting to. index.php is the file that your directed to when you enter a site, but your calling it from the redirect page. Just try this. Change the name to anything else and see if you are still having the problem.
sunfighter is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:22 AM.


Advertisement
Log in to turn off these ads.