如何设置页面,以便当用户使用 Pc(Safari/Chrome/Firefox)时,用户获得“正常”网页,但是当他使用“ipad”查看相同的 URL 时,他获得 Sencha Touch(css,js) 文件到他的浏览器?JavaScript 浏览器检测,导航器?还是 Sencha 对此有本机解决方案?我知道Ext.env.Browser
但用户可以在 PC 和 IPAD 上使用 Safari?有任何想法吗?谢谢!
问问题
2766 次
3 回答
1
我认为最好和最干净的解决方案是在服务器端添加此功能。检查用户代理请求标头以决定要发送哪些文件。您还可以重定向到不同的子域,例如 m.example.com。但是如果你想用 sencha 来做,那么请阅读这篇文章:http ://www.sencha.com/learn/idiomatic-layouts-with-sencha-touch
于 2011-10-12T10:47:41.943 回答
1
可能你必须使用media query
这个
检查这个http://css-tricks.com/snippets/css/media-queries-for-standard-devices/
于 2011-10-12T08:54:04.917 回答
0
例子:
<script type="text/javascript">
var isiPad = navigator.userAgent.match(/iPad/i) != null;
var isiPhone = navigator.userAgent.match(/iPhone/i) != null;
if(isiPad){
alert("Ipad");
//window.location = "http://www.google.com/iPad/"
}if(isiPhone){
alert("Iphone");
//window.location = "http://www.google.com/iPhone/"
}else{
window.location = "http://www.google.com"
}
</script>
于 2011-10-12T12:44:47.243 回答