Best method for mobile website
I have a website ready but it doesnt look too good on a mobile phone. I think it would be too complicated to use CSS media queries at this point.
I code another page specifically for mobiles. How would I go about redirecting visitors from mobiles to the mobile version ?? Or better still, go from abc.com/home.html to abc/com/mobile.html if viewport < 600px ?
This is开发者_StackOverflow社区 just for my College Technical festival so I dont expect much traffic on the mobile version, but want to be safe. If possible I would like to use a web service to create the page saving me the hassle of coding everyhing in. I tried paperlinks.com , and its perfect except for the fact that the is 'welcome to paperlinks'. Any other service out there. (must have intro, photo gallery, videos, contact details, if possible coments )
There are several options:
1) Javascript, something like
<script language=javascript>
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)))
{
location.replace("http://mobile.myurl.com");
}
</script>
2) apache rewrite (assuming apache) (obviously not an extensive list!)
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} iPhone
RewriteCond %{HTTP_USER_AGENT} iPod
RewriteRule .* http://mobile.myurl.com/ [R]
精彩评论