Javascript 正在获取重定向到此页面的URL

Javascript 正在获取重定向到此页面的URL,javascript,referrer,Javascript,Referrer,在此代码中: if (screen.width <= 800) { window.location = "http://www.megaoferta.bg/mobile"; } if(screen.width您可以使用文档引用器: var x = document.referrer; 您可以使用文档引用器: var x = document.referrer; 作为旁注,永远不要使用window.location…使用window.location.href。这与回答问题无关

在此代码中:

if (screen.width <= 800) {
    window.location = "http://www.megaoferta.bg/mobile";
}

if(screen.width您可以使用文档引用器:

var x = document.referrer;

您可以使用文档引用器:

var x = document.referrer;

作为旁注,永远不要使用
window.location
…使用
window.location.href
。这与回答问题无关,如果我不提,那就是失职。3作为旁注,永远不要使用
window.location
…使用
window.location.href
。这与回答问题无关,只是如果我没有提到的话,那我就是失职了。3这是使用整个URL地址,我如何才能只获取域?例如:google.com没有
http://
www
如果推荐人使用SSL,这将不起作用。google默认启用了SSL。这是使用整个URL地址,我如何只获取域?例如:goog没有
http://
www
的le.com,如果推荐人使用SSL,这将不起作用。谷歌默认启用SSL。