我刚刚完成了我的第一个网站,其中考虑了移动优先的响应式设计流程。 该网站在移动设备上看起来很棒,但是桌面体验非常缺乏。 在不影响移动体验的情况下,我没有什么好办法可以改善桌面体验,即使这样,我也有一些使用纯客户端方法无法做到的事情。
我不想管理两个单独的网站(移动,桌面)。 我想要做的是让移动检测服务器端更多地控制何时加载/显示更多数据等。
我想做类似的事情:
// in view ... if not request.mobile: related_posts = post.get_related_posts() ... // in template ... {% if not request.mobile and related_posts %} {{ related_post_stream(related_posts) }} {% endif %} ...令人惊讶的是,我没有看到很多关于以这种方式做事的在线讨论。 我读过的大多数文章要么推荐纯粹的(移动优先)响应式设计,要么推荐单独的移动网站,尽管这看起来不错。 这样做有不利之处吗?
I have just finished building my first website with a mobile-first responsive design process in mind. The site looks and works great on mobile devices, but the desktop experience is quite lacking. There's no good way I can improve the desktop experience without compromising the mobile experience, and even then there are just some things I can't do using a pure client side approach.
I don't want to have to manage two separate websites (mobile, desktop). What I want to do is have mobile detection server side to have more control of when I load/display more data, etc.
I want to do something akin to:
// in view ... if not request.mobile: related_posts = post.get_related_posts() ... // in template ... {% if not request.mobile and related_posts %} {{ related_post_stream(related_posts) }} {% endif %} ...Surprisingly, I don't see much online discussion about doing things this way. Most articles I've read either recommend pure (mobile-first) responsive design or a separate mobile website, although this seems like a decent idea. Is there a downside to doing this?
最满意答案
如果你使用Django,有django-mobile模块,它允许你检查模板中的移动使用情况,如下所示:
{% if flavour != "mobile" %}Desktop version{% endif %}如果您不使用Django,您仍然可以分析该模块的来源并为您的网站实现类似的功能。
If you are using Django, there is django-mobile module which allows you to check the mobile usage in the template like this:
{% if flavour != "mobile" %}Desktop version{% endif %}If you are not using Django, you can still analyze the source of that module and implement something similar for your website.
更多推荐
发布评论