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 5 of 5
  1. #1
    Registered User
    Join Date
    Oct 2002
    Location
    Manchester, England
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Automatic page redirection

    I have been looking for a script so that you can be redirected to another page without clicking on a link.

    An example of what I wish to attain happens on this site.

    On this site when you have logged in you get a page which is a redirection page and after about 10 seconds it automatically redirects you to the main forum page.
    Also a secondary button so that if it doesn't work.

    Has anyone any idea where I can get hold of such a script.

    I need this script as the URL of a page is changing and so that anyone who links from an external website they will be redirected to the page with the new URL. This is to give external websites the chance to update their links.

    All help much appreciated
    Last edited by charter; 04-22-2004 at 01:43 PM.

  • #2
    Regular Coder
    Join Date
    Apr 2003
    Location
    Atlanta, GA
    Posts
    487
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <html><head><title>Page Moved.</title>
    <meta http-equiv="Refresh" content="5, your URL here" />
    </head><body>
    <p>This page has moved, and should redirect you.</p>
    <a href="your URL here">Please update your bookmarks.</a>
    </body></html>
    No script necessary.

  • #3
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    the problem with meta refresh is that it stays in the browser's history, so clicking back wouldn't get you anywhere - you'd just get redirected back to whence you came.

    it's better (and far less annoying to the user) to use JS for this. in the head of the document, put:

    Code:
    <script language="Javascript">
    
         var sUrl = "yourpath_or_url" ;
         location.replace(sUrl) ;
    
    </script>
    you can still use a meta-refresh for non-JS browsers, such as web-bots, so they can still navigate your site. to do this, again in the head of the document type this:

    Code:
    <noscript><meta http-equiv="Refresh" content="5, your URL here" /></noscript>
    ok?!

  • #4
    Regular Coder
    Join Date
    Apr 2003
    Location
    Atlanta, GA
    Posts
    487
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Giving a five-second redirect when a site's URL changes is not typically considered an inconvenience, nor does it break the back button (not that yours breaks it either). It's a classic, de facto standard way to alert a surfer that a site has moved, and that bookmarks to the site should be updated.

  • #5
    Registered User
    Join Date
    Oct 2002
    Location
    Manchester, England
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Many thanks to Choopernickel & J-Bot.


  •  

    Posting Permissions

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