电脑PC端与手机移动m端互相跳转代码

<script type="text/javascript">    
var siteurl = 'https://m.yourdomain.com';    
// 跳桌面版    
if (!(navigator.userAgent.match(/(iPhone|iPod|Android|Windows Phone)/i))) {    
var url=_window.location.href;    
// url=url.replace('http://m.','http://www.');    
url=url.replace('https://m.','https://www.');    
location.replace(url);    
}    
</script>    

上面代码是在手机模板head内加入
<script type="text/javascript">
            var new_url = _window.location.href;
            if(new_url.indexOf('http://yourdomain') >= 0 || new_url.indexOf('https://yourdomain') >= 0) {
                new_url = new_url.replace('http://yourdomain', 'http://www.yourdomain');
                new_url = new_url.replace('https://yourdomain', 'http://www.yourdomain');
                _window.location.replace(new_url);
            }
            var siteurl = 'http://www.iyourdomain.net/';
        </script>
                <script type="text/javascript">
            <!--跳m站-->
            function getCookie(nm) {
                var arr, reg = new RegExp("(^| )" + nm + "=([^;]*)(;|$)");
                if (arr = [xss_clean].match(reg)) {
                    return unescape(arr[2]);
                } else {
                    return null;
                }
            }
            if ((navigator.userAgent.match(/(iPhone|iPod|Android|Windows Phone)/i))) {
                if(getCookie('mfjian') == null) {
                    var url = _window.location.href;
                    url = url.replace('http://yourdomain', 'http://m.yourdomain');
                    url = url.replace('https://yourdomain', 'https://m.yourdomain');
                    url = url.replace('http://www.', 'http://m.');
                    url = url.replace('https://www.', 'https://m.');
                    location.replace(url);
                }
            }/*else{
                var curProtocol = _window.location.protocol.split(':')[0];
                if (curProtocol === 'http') {
                    var url=_window.location.href;
                    url=url.replace('http://','https://');
                    location.replace(url);
                }
            }*/
        </script>
        
        
         在电脑模板head中加入


当前是游客状态,未注册无法查看隐藏信息!


收藏 999+ 打赏

感谢您的支持,我会继续努力的!

打开微信扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 999+

1、如非特殊说明,本站对本文提供的代码或者素材不拥有任何权利,其版权归原著者拥有。
2、以上提供的代码或者素材均为作者提供和网友推荐收集整理而来,仅供学习和研究使用。
3、如有侵犯你版权的,请来信(邮箱:admin@mail.52muban.com)指出,核实后,本站将立即改正。
4、如有链接无法下载、失效或广告,请点击下面的报错或者联系我们处理!
5、以上资源售价只是赞助,不代表代码或者素材本身价格。收取费用仅维持本站的日常运营所需!

魏东SEO 建站 电脑PC端与手机移动m端互相跳转代码 http://www.lyg95.com/show-34.html

专注网站开发,建设。

常见问题
  • A:我们的演示全是模板的实际效果截图,确保为你提供模板真实效果。网上总有人想尽一切办法偷取我们的模板数据,所以没办法只能暂时采用的这种一比一截图演示方法,给您带来不便,希望能理解,我们一直在为如何让客户能感受到模板真实的效果而努力。
查看详情
  • 因为模板具有可复制性和可传播性,模板一旦发货,非质量问题,不支持退换;所以务必请您一定看清楚后再购买;
查看详情
  • A:模板基本上全是后台控制的,90%的数据都可以通过后台修改的,我们提供的是模板使用范围内技术指导;如果涉及一定工作量的修改,我们会收取合理的修改费用;如果您能自己修改的最好自己修改,我们也不想加收您的费用,我们这边服务压力特别大,希望您能理解。
查看详情
  • A:不要以价格比产品,因为全网模板提供商都不缺产品,差的就是后期服务。原因1)我们所有模板都经过精心测试,保证完整无误,每套模板有配套的教程。原因2)我们一直在涨价,是因为我们的模板质量和系统优化一直在提升,请不要单纯的比价格,应该比它的价值。如果您只是单独追求便宜,不求后期保障,建议您直接通过淘宝购买盗版产品。
查看详情

相关文章

评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务

-->