zoukankan      html  css  js  c++  java
  • 效果A:浏览器跳转以及判断来路客户信息

    window.parent控制父对象跳转

    判断手机型号

     private string PhoneType(string phonetype)
            {
                string startRule = ";([^(;)]*)/";
                Regex typeRule = new Regex(startRule);
    
                MatchCollection types = typeRule.Matches(phonetype);
                foreach (Match type in types)
                {
                    if (type.Value.Contains("Build"))
                    {
                        string result = type.Value.ToString().Substring(2, type.Value.ToString().IndexOf("/") - type.Value.ToString().IndexOf(";") - 2);
                        return result;
                    }
                }
                if (phonetype.Contains("iPhone"))
                {
                    int startIn = phonetype.IndexOf(";");
                    phonetype = phonetype.Substring(startIn, 29);
                    string iphoneRule = @"(d)_(d)_(d)";
                    Regex iphoneType = new Regex(iphoneRule);
                    if (iphoneType.IsMatch(phonetype))
                    {
                        string result = iphoneType.Match(phonetype).ToString().Replace("_", "");
                        if (result == "511")
                        {
                            return "iphone4";
                        }
                        else
                        {
                            return "iphone5";
                        }
                    }
                }
                return null;
            }

    百度关键词

     /// <summary>
            /// 判断百度搜索来源
            /// </summary>
            /// <param name="referrer"></param>
            private string PushOrigInfo(string referrer)
            {
                if (referrer.Contains("baidu"))
                {
                    string wdRule = "wd([^&]*)&";
                    Regex regwd = new Regex(wdRule);
                    System.Text.RegularExpressions.Match wdMath = regwd.Match(referrer);
                    if (string.IsNullOrEmpty(wdMath.Value))
                    {
                        wdRule = "bs([^&]*)&";
                        wdMath = regwd.Match(referrer);
                    }
    
                    string pnRule = "pn([^&]*)&";
                    Regex regpn = new Regex(pnRule);
                    System.Text.RegularExpressions.Match pnMath = regpn.Match(referrer);
                    return wdMath.Value + ":" + pnMath.Value;
                }
                else
                {
                    return null;
                }
            }

    前端方式

     //获取搜索近来时的关键词
        var sosuo = aa.split(".")[1];
        var rep = null;
        var str = null;
        var keyword = null;
        switch (sosuo) {
            case "baidu":
                rep = /wd=.*&/i;
                str = aa.match(rep);
                keyword = str.toString().split("=")[1].split("&")[0];
                // return decodeURIComponent(keyword);
                
                break;
            case "google":
                rep = /wd=.*&/i;
                str = aa.match(rep);
                keyword = str.toString().split("=")[1].split("&")[0];
                
                break;
            case "sogou":
                rep = /wd=.*&/i;
                str = aa.match(rep);
                keyword = str.toString().split("=")[1].split("&")[0];
                
                break;
            default:
                return aa;
                break;
        }
    View Code
  • 相关阅读:
    广商博客冲刺第六七天new
    广商博客沖刺第一天(new ver):
    20150529项目之典型用户与场景
    冲刺第二,三,四,五,六天
    冲刺第一天:
    Android 學習之旅!(2)
    20150512 作业6 团队项目之需求
    Android 學習之旅!(1)
    20150421 作业5 四则运算 测试与封装 5.1 5.2(doing)
    20150421 作业5 四则运算 测试与封装 5.1
  • 原文地址:https://www.cnblogs.com/wanglao/p/3540808.html
Copyright © 2011-2022 走看看