var _hmt = _hmt || []; (function() { var sUserAgent = navigator.userAgent.toLowerCase(); var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os"; var bIsMidp = sUserAgent.match(/midp/i) == "midp"; var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4"; var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb"; var bIsAndroid = sUserAgent.match(/android/i) == "android"; var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce"; var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile"; // 新增百度统计代码 var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?988cde00585dc088b30fc267682deb5d"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) { // window.location.replace('https://h5.yit.com'); var path = location.pathname var replaceUrl = 'https://h5.yit.com' var parseQuery = function (query) { if(!query) return {} if(query.indexOf('?')==0){ query = query.substr(1) } var reg = /([^=&\s]+)[=\s]*([^&\s]*)/g; var obj = {}; while (reg.exec(query)) { obj[RegExp.$1] = RegExp.$2; } return obj; } var queryObject = parseQuery(location.search) if(path == '/'){ //跳h5首页 replaceUrl='https://h5.yit.com?utm_source=2.o1.585' }else if(path == '/shop/product'){ //跳h5详情页 replaceUrl='https://h5.yit.com/r/product?product_id='+queryObject.productId+'&utm_source=2.o1.585' }else if(path == '/media'){ //跳h5生活贴 replaceUrl='https://h5.yit.com/r/lifePosted?utm_source=2.o1.585' }else if(/\/media\/[0-9]+/.test(path)){ let arr = path.match(/[0-9]+/) //跳h5生活贴文章详情 replaceUrl='https://h5.yit.com/r/lifePosted/pgc?postId='+arr[0]+'&utm_source=2.o1.585' }else if(path == '/store'){ //跳h5店铺列表 replaceUrl='https://h5.yit.com/r/storeList?utm_source=2.o1.585' } window.location.replace(replaceUrl) } })();