Javascript 正常取来源网页的URL只要用:

 document.referrer

就可以了!

但,如果来源页是Javascript跳转过来的,上边的方法就拿不到了!所以用:

 opener.location.href

所以,就有了下边的代码:

var ref = '';   if (document.referrer.length > 0) {    ref = document.referrer;   }   try {   if (ref.length == 0 && opener.location.href.length > 0) {     ref = opener.location.href;    }   } catch (e) {}

其它相关的:

window.location.href  window.location.pathname 
var num = Math.round(Math.random()*10000);  window.location.href = (window.location.pathname)+'?'+num+';

 

相关文章:

  • 2022-03-05
  • 2022-12-23
  • 2021-09-10
  • 2022-12-23
  • 2021-06-26
  • 2021-08-19
  • 2022-03-07
  • 2022-02-27
猜你喜欢
  • 2022-02-07
  • 2021-09-08
  • 2022-01-07
  • 2022-12-23
  • 2021-10-16
  • 2021-10-16
相关资源
相似解决方案