开发者

Best method for mobile website

开发者 https://www.devze.com 2023-03-21 20:36 出处:网络
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 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]
0

精彩评论

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