我的网站

帝国CMS移动站自动适配跳转,首页/栏目频道/内容页各不同

分类:编程 发布日期:2024-03-16 11:14 浏览:3
//首页
<script type=”text/javascript”>
try {
	var urlhash = window.location.hash;
	console.log(urlhash);
	if (!urlhash.match("fromapp"))
	{
		if((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i)))
		{
			window.location="https://m.XXXX.com/";
		}
	}
}
catch(err)
{
}
</script>
<meta name="mobile-agent" content="format=xhtml;url=https://m.XXXX.com/">

//列表页
<script type="text/javascript">
try {
	var urlhash = window.location.hash;
	console.log(urlhash);
	if (!urlhash.match("fromapp"))
	{
		if((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i)))
		{
			window.location="https://m.XXXX.com<?=sys_ReturnBqClassUrl($class_r[$GLOBALS[navclassid]]);?>";
		}
	}
}
catch(err)
{
}
</script>
<meta name="mobile-agent" content="format=xhtml;url=https://m.XXXX.com<?=sys_ReturnBqClassUrl($class_r[$GLOBALS[navclassid]]);?>">

//内容页
<script type="text/javascript">
try {
	var urlhash = window.location.hash;
	console.log(urlhash);
	if (!urlhash.match("fromapp"))
	{
		if((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i)))
		{
			window.location="https://m.XXXX.com[!--titleurl--]";
		}
	}
}
catch(err)
{
}
</script>
<meta name="mobile-agent" content="format=xhtml;url=https://m.XXXX.com[!--titleurl--]">
← 上一篇:帝国模板使用记录 下一篇:好用的网页图片下载 chrome扩展 →

相关文章