I think document.referrer is only set when the page is originated from a link on the previous page, doing location.href/location.replace will result in an empty document.referrer
pass the current url along, for example (of course, if you are using location.href/location.replace(), you need to make changes): <script language="javascript"> function document.onclick() { if (event.srcElement.tagName == "A") { event.srcElement.href += "?url="+location.href; }} </script>
如果无法完成,直接访问也会弹一个窗口然后自动关闭,一闪
<script language="javascript">
function document.onclick()
{
if (event.srcElement.tagName == "A")
{
event.srcElement.href += "?url="+location.href;
}}
</script>