Javascript 正常取来源网页的URL只要用:
  1. 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  :当前url

  window.location.pathname  :url中“/”以后的部分

相关文章:

  • 2021-11-28
  • 2022-12-23
  • 2021-12-05
  • 2021-12-18
  • 2021-06-24
  • 2019-01-09
  • 2022-12-23
  • 2021-06-25
猜你喜欢
  • 2021-04-04
  • 2021-09-27
  • 2021-10-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案