1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Redirect And Keep Referer

Discussion in 'General Programming Chat' started by manudevil20, Nov 26, 2008.

  1. manudevil20

    manudevil20 Jr. VIP Jr. VIP Premium Member

    Joined:
    Mar 28, 2008
    Messages:
    695
    Likes Received:
    278
    Location:
    Idaho
    Hi everyone. I have done a simple redirect on my 404 page that goes to a different domain. How can i have it so i keep the referer. Thanks
     
  2. manudevil20

    manudevil20 Jr. VIP Jr. VIP Premium Member

    Joined:
    Mar 28, 2008
    Messages:
    695
    Likes Received:
    278
    Location:
    Idaho
    Nobody has an idea than? Thanks everyone :D
     
  3. livelybrowser

    livelybrowser Senior Member

    Joined:
    Nov 20, 2008
    Messages:
    935
    Likes Received:
    371
    Home Page:
    Code:
    <html>
    <head>
    <title>Redirecting</title>
    <script type="text/javascript">
    function redirect(url)
    {
    	if(document.all){
    		document.write("<a id='targeturl' href='"+url+"' style='display:none;'>Redirecting</a>");
    		document.getElementById("targeturl").click();
    	}else{
    		window.location=url;
    	}
    }
    </script>
    </head>
    <body 
    onload="redirect('http://www.targeturl.com/')">
    </body>
    </html>
     
    • Thanks Thanks x 1
  4. manudevil20

    manudevil20 Jr. VIP Jr. VIP Premium Member

    Joined:
    Mar 28, 2008
    Messages:
    695
    Likes Received:
    278
    Location:
    Idaho
    Thank you it worked great for me. Just what i needed. :)
     
  5. livelybrowser

    livelybrowser Senior Member

    Joined:
    Nov 20, 2008
    Messages:
    935
    Likes Received:
    371
    Home Page:
    I am so happy to help you out. I am new to this forum for about three days. Looking forward to getting your help and support in future.