-->

How to create a mobile friendly website [infrastru

2019-04-11 23:22发布

问题:

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.