zoukankan      html  css  js  c++  java
  • 各个搜索引擎,获取搜索词的脚本

    //正式上线把上网址屏蔽,去掉此行前面代码
    function GetQueryString() {
        var refer = document.referrer;
        refer = refer + '&';
        var matches = '';
        if(refer.match(/(www|m|youxuan).baidu/)){
            matches = refer.match(/W(wd|word)=(.*?)&/i);
            if(matches){
                matches = matches[2];
            }
        };
        if(refer.match(/m.sm.cn/)) {
            matches = refer.match(/q=(.*?)&/i);
            if(matches) {
                matches = matches[1];
            }
        };
        if(refer.match(/(www|m).sogou/)) {
            matches = refer.match(/W(query|keyword)=(.*?)&/i);
            if(matches) {
                matches = matches[2];
            }
        };
       if(refer.match(/so.com/)) {
            matches = refer.match(/q=(.*?)&/i);
            if(matches) {
                matches = matches[1];
            }
        };
        if(matches && matches.indexOf("%") == 0) {
            matches = decodeURIComponent(matches);
        } else {
            matches = '';
        };
    
        return matches;
    };
    var wd = GetQueryString();
    if(wd && wd.length > 0){
        wd = decodeURIComponent(wd);
        var line = wd;
    }else{
        line = '.';
    }
  • 相关阅读:
    C语言II作业01
    C语言寒假大作战04
    C语言寒假大作战03
    C语言寒假大作战02
    C语言寒假大作战01
    C语言ll作业01
    C语言寒假大作战04
    C语言寒假大作战03
    C语言寒假大作战02
    C语言寒假大作战01
  • 原文地址:https://www.cnblogs.com/feixiablog/p/12731353.html
Copyright © 2011-2022 走看看