I know that I can get the host name of the current page by simply doing:
var myhostname = location.hostname;
But how to get the host name for the referrer? I can get a referrer
var referrer = document.referrer;
but unfortunately there is no document.referrer.hostname available in JavaScript. How can I get this value?
An example of where this is useful is if someone clicks a link to google.com. I want to be able to retrieve google.com from the referrer (not the pages and query strings).
javascript
Keltex Aug 05 '10 at 23:47 2010-08-05 23:47
source share