Redirect And Keep Referer

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

  1. manudevil20

    manudevil20 Power 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 Power 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:
    372
    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 Power 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:
    372
    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.