当前位置:编程学习 > asp >>

asp 判断 来自那个搜索引擎

本教程告诉你用asp来判断当前浏览用户来自那里,如果来自那个搜索引擎之类的,下面我们就来看看写法吧.

  function getSearchKeyword(sRefererUrl){  //取搜索引擎中的关键字
   var p = "("
      + "google.+?q=([^&]*)" + "|sina.+?word=([^&]*)"
      + "|sohu.+?word=([^&]*)" + "|163.+?q=([^&]*)"
      + "|yahoo.+?p=([^&]*)" + "|baidu.+?word=([^&]*)"
      + "|openfind.+?q=([^&]*)" + "|lycos.+?query=([^&]*)"
      + "|aol.+?query=([^&]*)" + "|onseek.+?keyword=([^&]*)"
      + "|3721.com.+?name=([^&]*)" + "|search.tom.+?word=([^&]*)"
      + ")";
   var r = new RegExp(p,'gim');
   var a = r.exec(sRefererUrl);
   if(a) for(var i=a.length-1;i>=0;--i) if(a[i]) try{return decodeURIComponent(a[i])}catch(e){return a[i]};
   return '';
  }

补充:asp教程,高级应用 
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,