views:

573

answers:

2

** 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 exception for iPads, so that they load the normal site and not the mobile version?

+1  A: 

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.

ceejayoz
Thanks, I'm editing my original post so that you can see how I'm detecting the mobile site...
BigDogsBarking
Uh, that script would detect Windows CE. It would never redirect an iPad. The jQuery stuff has nothing to do with detection/redirection, either.
ceejayoz
I know, that's my question... How to also redirect an ipad?
BigDogsBarking
Your question reads exactly opposite of that. You say your site redirected an iPad to the mobile site, and asked "Does anyone know how to make an exception for iPads, **so that they load the normal site** and not the mobile version?"
ceejayoz
+4  A: 
<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/";}
texmex5
Not sure that will really work with what I'm doing? I edited my original post to include the code I'm using to detect whether it's a mobile device...
BigDogsBarking
Edited my original post to include JavaScript sample.
texmex5