..js获取refer搜索关键词

if (refer != '') {
        domain = refer.match(/http:\/\/www\.([^\/]+)\//)[1];
        var kwArr = [{ "dm": "so.com", "kw": "q", "name": "360" }, { "dm": "google.com.hk", "kw": "q", "name": "谷歌香港" }, { "dm": "baidu.com", "kw": "wd|word", "name": "百度" }, { "dm": "soso.com", "kw": "w", "name": "搜搜" }, { "dm": "yahoo.com", "kw": "q", "name": "雅虎" }, { "dm": "bing.com", "kw": "q", "name": "bing" }, { "dm": "sogou.com", "kw": "query", "name": "搜狗" }, { "dm": "youdao.com", "kw": "q", "name": "有道"}];
        for (var item in kwArr) {
            var $dm = kwArr[item].dm;
            var $kw = kwArr[item].kw;
            var $name = kwArr[item].name; if (domain == $dm) {
                eval("var reg = /[?&](" + $kw + ")=(.+?)(&|$)/ig;");
                var keywordCollection = reg.exec(refer);
                while (keywordCollection != null) {
                    keyword = RegExp.$2 + ",";
                    keywordCollection = reg.exec(refer);
                } if (keyword != '') {
                    keyword = keyword.substring(0, keyword.length - 1);
                } channel = $name; userkeyword = decodeURI(keyword);
            }
        }
    }

你可能感兴趣的:(.net,2014)