How to create a mobile friendly website [infrastructure]

断了今生、忘了曾经 提交于 2020-01-13 05:07:55

问题


if i wanted to create a mobile friendly version of a relatively small website would it be better to have a sub domain that redirects to a completely new url with separate markup and styling or would it be better to detect the user agent in code and programmatically change to a different mobile friendly stylesheet, or is their a better infrastructure based solution i am overlooking..

Thanks.


回答1:


If SEO isn't really a concern, Using different stylesheets with the same HTML is much easier, in terms of maintenance.




回答2:


You could try abit of both. Have the main site detect the useragent, then redirect to the completly new domain. That way its more automated but your main site code wont have tons of if statements depending on if its a mobile or not as the new domain would take care of that.

If you go with this tho, always add a link on the mobile site so that users can view the main site if they please... use cookies tho else youll end up getting redirected to the mobile site.



来源:https://stackoverflow.com/questions/2713470/how-to-create-a-mobile-friendly-website-infrastructure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!