开发者

iPad vs. iPhone - Adjusting CSS / HTML?

开发者 https://www.devze.com 2022-12-30 02:33 出处:网络
** EDIT ** This is the code I\'m using to detect whether it\'s a mobile device: <!-- Javascript inclusion -->

** EDIT **

This is the code I'm using to detect whether it's a mobile device:

<!-- Javascript inclusion -->
<script type="text/javascript">
var isCE = navigator.appVersion.indexOf("Windows CE")>0;if (isCE){ window.location.href="http://m.mobileversionsample.com/";}
</script>
<script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
jQuery.preloadImages = function()
{
for(var i = 0; i<arguments.length; i++)
{
jQuery("<img>").attr("src", arguments[i]);
}
}
</script>

Went to the Apple store and saw that my mobile site picks up on an iPad as well... Does anyone know how to make an e开发者_如何学Cxception for iPads, so that they load the normal site and not the mobile version?


<link rel="stylesheet" media="only screen and (max-device-width: 1024px)" href="../ipad.css" type="text/css" />

About supporting both landscape and portrait mode: http://www.cloudfour.com/ipad-css/

Detecting iPad using Javascript: http://davidwalsh.name/detect-ipad

var isiPad = navigator.userAgent.match(/iPad/i) != null; 

if(isiPad) { window.location.href="http://m.mobileversionsample.com/";}


That would depend a lot on the code you're using to detect mobile browsers. You're presumably using the User-Agent string to detect something like "MobileSafari" - just add a conditional that skips the redirect if "MobileSafari" AND "iPad" are in the User-Agent string.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号