Fernando Rodríguez wrote on 23 feb 2006 in comp.lang.javascript
:
Is there a way to turn the document.referrer string into a Location like
object, so I can extrac the domain and other parts of it?
What is a "Location like object"?
Do you mean you want to use part of the string from the referrer as a
string for location.href?
<button onclick='
if (document.referrer && document.referrer!="")
location.href = document.referrer;
'>Goto referrer</button>
not tested
Or do you just want to parse the string?
var domain = document.referrer.replace(/(\/\/[^\/]+\/).*/,'$1');
location.href = domain;
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)