时间:2019-07-19加入收藏
JS代码在body
前面加上以下HTML源代码
<script type="text/javascript"> try {var urlhash = window.location.hash;if (!urlhash.match("fromapp")) {if ((navigator.userAgent.match(/(ipod|iphone|android|coolpad|mmp|smartphone|midp|wap|xoom|symbian|j2me|blackberry|wince)/i))) {window.location="`http://m.bingdou.com.cn/`";}}} catch(err) { }</script>
<meta name="mobile-agent" content="format=xhtml;url=`http://m.bingdou.com.cn/`">
动态页:http://m.bingdou.com.cn/e/action/ListInfo/?classid=[!--self.classid--]
静态页:http://m.bingdou.com.cn<?$r['classid']=$GLOBALS[navclassid];$classurl=sys_ReturnBqClassname($r,9);echo $classurl;?>
动态页:http://m.bingdou.com.cn/e/action/ShowInfo.php?classid=[!--classid--]&id=[!--id--]
静态页:http://m.bingdou.com.cn[!--titleurl--]
分成动态与静态页面,可自行选择更换
bingdou.com.cn为自己的子域名。
JS代码在body
前面加上以下HTML源代码
<script type="text/javascript">
var dynamicLoading = {
css: function(path){
if(!path || path.length === 0){
throw new Error('argument "path" is required !');
}
var head = document.getElementsByTagName('head')[0];
var link = document.createElement('link');
link.href = path;
link.rel = 'stylesheet';
link.type = 'text/css';
head.appendChild(link);
},
js: function(path){
if(!path || path.length === 0){
throw new Error('argument "path" is required !');
}
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.src = path;
script.type = 'text/javascript';
head.appendChild(script);
}
}
function getCookie(name)
{
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
if(arr=document.cookie.match(reg))
return unescape(arr[2]);
else
return null;
}
function setCookie(name,value)
{
var Days = 30;
var exp = new Date();
exp.setTime(exp.getTime() + Days*24*60*60*1000);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
function change(type){
setCookie('allmobile',type);
window.location.reload();
}
function initPage(){
var type = getCookie('allmobile');
if(type == undefined || type == null){
//根据屏幕大小显示对应样式
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";
if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
}else{
window.location.href="http://www.bingdou.com.cn/";
}
}
else if(type == 'desktop'){
$("#return_iphone").css("display","block !important");
window.location.href="http://www.bingdou.com.cn/";
}else if(type == 'mobile'){
}
}
initPage();
</script>
TGA: jquery