获取google搜索关键字

function getGoogleSearchKeyword(){
 var lastUrl = document.referrer.toString();
 //http://www.google.com/search?hl=en&q=javaeye&  btnG=Search
 if(!lastUrl.match(/google\.com\/search\?/))return;
 var p = lastUrl.indexOf('?');
 var params = lastUrl.substr(p+1).split('&');
 for(var i=0,l=params.length;i<l;i++){
   if(params[i].indexOf("q=")+1){
   return params[i].split("=")[1];
   }
 }
}

依据qichunren 回答的我对javaeye[你正在搜索xxx]泡泡框的疑问http://www.iteye.com/problems/8391 ,我完成的作业,感谢qichunren!

你可能感兴趣的:(Google)