如何将我的网站重定向到移动网站 [英] How to redirect my web site to mobile web site

查看:74
本文介绍了如何将我的网站重定向到移动网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我必须重定向到我的移动网站.我创建了两个站点的桌面站点和移动站点.如果我们在移动设备中查看,Side应该重定向到m.site.com之类的移动网站.我给了代码

Hi,
I have to redirect to my mobile site. I have created two site''s Desktop site and mobile site. If we view in mobile the Side should redirect to mobile site like m.site.com. I given the code

<script type="text/javascript">
$(document).ready(function(){
  if($(window).width() < 480){

           window.location = "http://mobile.yoursite.com"

  }

});

</script>



但是,当我同时提供了现成的和人体加载功能时,但是以这两种格式,桌面站点将首先加载,然后仅将其重定向到移动站点.我尝试< link rel ="alternate" media ="handheld" href ="http://m.yoursite.com">.但是,这没有用.还有什么其他方法可以帮助我.



But when i given this on ready and body load function also, but in these two format the desktop site is first loading and then only it is redirected to mobile site. I try''d <link rel="alternate" media="handheld" href="http://m.yoursite.com">. But this not worked. Is there any other way please help me.

推荐答案

(document).ready(function(){ if(
(document).ready(function(){ if(


(window).width()< 480){ span> window.location = " } }); </script >
(window).width() < 480){ window.location = "http://mobile.yoursite.com" } }); </script>



但是,当我同时提供了现成的和人体加载功能时,但是以这两种格式,桌面站点将首先加载,然后仅将其重定向到移动站点.我尝试< link rel ="alternate" media ="handheld" href ="http://m.yoursite.com">.但是,这没有用.还有什么其他方法可以帮助我.



But when i given this on ready and body load function also, but in these two format the desktop site is first loading and then only it is redirected to mobile site. I try''d <link rel="alternate" media="handheld" href="http://m.yoursite.com">. But this not worked. Is there any other way please help me.


add
.xaml中的IsScriptEnabled ="True"
add
IsScriptEnabled="True" in u r .xaml


这篇关于如何将我的网站重定向到移动网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆