I have a page where in Javascript I add to the location hash something like: location.hash = \"initial_source=previous_referrer\".
Afterwards a window.location is d
location.href = redirect_url.split("#")[0] + "#" + document.referrer;