Hi first time DP poster long time listener big up to Shawn and the mods! I'm trying to get clarification about which referrer is sent when using javascript redirect window.location.replace example: Site A links to Site B which immediately redirects with window.location.replace to site C from what I've tested Site C referrer using IE=no referrer and using Firefox=Site B using Opera=Site B (didn't test Safari) and back button goes back to Site A My intention is to redirect from site A to site C without site C detecting referrer from site A Will window.location.replace work for this purpose? PS This can be done with meta refresh though that breaks the back button.
To accomplish this, you can use server side 301 redirect, that will pass the original referrer. Server side programming like PHP, asp or even CF.
Thanks for the reply. I don't want to pass the original referrer My intention is to redirect from site A via a redirect on site B to site C without site C detecting referrer from site A- also back button will take user back to site A As far as I can see window.location.replace will do this. Can anyone confirm this or suggest any shortcomings of using this redirect?
1. Do you want Site B to be passed as the referrer to Site C (and keep Site A's URL hidden), or do you want a blank referrer to be passed to Site C? 2. If the user hits the back button, do you want them to go back to Site A or Site B?
@vpguy 1. He probably doesn't care, just doesn't want Site A's URL to show 2. Wants it to go to Site A when hitting back Well, from the sound of your tests, your method will work fine. You don't have to use document.location.replace though. You can simply do document.location = "new site"; I do not think the method I've provided will change any of your results so you should be good to go.
Thanks Zerxer- yes correct on both points Is there advantage to document.location versus window.location.replace? such as speed of redirect or browser compatibility?
Actually, I have never used document.location.replace myself, so I decided to look it up. Setting document.location (example: document.location = "new url" will just load the new page while doing document.location.replace("new url") will load the new page and replace the current page in the user's History with the new one. I'm pretty sure with what you're trying to do, you'd rather use document.location.replace() so that Site B does not show in the history? Yes, because that would stop it from going back to that page when they hit the Back button. (I use document instead of window but I honestly don't know the difference between the two when changing the location. There might be compatibility differences but I think most sites recommend you use document.*)