How do I get the referrer’s domain/host name using JavaScript? February 28, 2023 by Tarik This would do: document.referrer.split("https://stackoverflow.com/")[2]; Example.