Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Nov 2012
    Location
    Australia
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,452
    Thanks
    23
    Thanked 631 Times in 630 Posts
    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>

  • #3
    Regular Coder Redcoder's Avatar
    Join Date
    May 2012
    Location
    /dev/null
    Posts
    334
    Thanks
    2
    Thanked 47 Times in 46 Posts
    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> 

  • #4
    Regular Coder Redcoder's Avatar
    Join Date
    May 2012
    Location
    /dev/null
    Posts
    334
    Thanks
    2
    Thanked 47 Times in 46 Posts
    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.

  • #5
    New to the CF scene
    Join Date
    Nov 2012
    Location
    Australia
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #6
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,452
    Thanks
    23
    Thanked 631 Times in 630 Posts
    Must be caused by the page your going to. What is it's name?

  • #7
    Regular Coder Redcoder's Avatar
    Join Date
    May 2012
    Location
    /dev/null
    Posts
    334
    Thanks
    2
    Thanked 47 Times in 46 Posts
    Or there may be another piece of conflicting code.

  • #8
    New to the CF scene
    Join Date
    Nov 2012
    Location
    Australia
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #9
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,452
    Thanks
    23
    Thanked 631 Times in 630 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •