head部分加如下代码:
<meta name="applicable-device"content="pc">
<link rel="canonical" href="https://www.56sys.com/jiyun.htm"/> <!--这里是让搜索引擎只收录一个页面-->
<meta http-equiv="mobile-agent" content="format=html5;url=https://m.56sys.com/jiyun.htm"/>
<meta http-equiv="mobile-agent" content="format=xhtml;url=https://m.56sys.com/jiyun.htm" />
<link rel="alternate" media="only screen and (max-width: 640px)" href="https://m.56sys.com/jiyun.htm">
head部分再引入一个Jqury
<script src="/js/jquery-3.1.1.min.js" charset="UTF-8"></script>
注意:min或者完整的都可以实现
body的底部加上如下代码
<script type="text/javascript">
(function() {
var u = navigator.userAgent;
if(u.match(/AppleWebKit.*Mobile.*/)){
var oLink=$("link[rel=alternate]");
if(oLink){
var sUrl=oLink.attr("href");
if(sUrl){setTimeout(function(){window.location.href=sUrl;},2000);};
}
}
})();
</script>
移动端的网页的head部分加上:
<link rel="canonical" href="https://www.56sys.com<%=wt_fileurl%>" >
<meta name="applicable-device"content="mobile">
最新评论