Update referer on redirect

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
jamiel
Forum Contributor
Posts: 276
Joined: Wed Feb 22, 2006 5:17 am
Location: London, United Kingdom

Update referer on redirect

Post by jamiel »

Hi all,

I am trying to do a redirect from one page to another but I want the final page to know where the redirect came from. However the default behavious (on Firefox and Opera at least) seems to keep the original page as the referer.

I have tried a meta refresh, a Location header and a javascript document.location but the browser still insists on keeping the original page as the referer rather than the page it got redirected from.

Does anyone know a way around this?

Thanks alot

Jamie
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Well, what you are doing isn't really "redirection," but rather "replacement." You could use sessions and save the current page prior to sending the new 'Location' header, as I do.
jamiel
Forum Contributor
Posts: 276
Joined: Wed Feb 22, 2006 5:17 am
Location: London, United Kingdom

Post by jamiel »

Unfortunately this is not ideal as I am redirecting to a 3rd party site.
jamiel
Forum Contributor
Posts: 276
Joined: Wed Feb 22, 2006 5:17 am
Location: London, United Kingdom

Post by jamiel »

For anyone interested, I have managed to "hack" around this by including an empty form with the action being my redirect page and doing a document.getElementById('myform').submit();
Post Reply