如何运行网站的移动版本? [英] How to run mobile version of a website?

查看:139
本文介绍了如何运行网站的移动版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行网站的移动版本有两种常用方法:

There are two common ways to run mobile version of a website:

  1. 通过服务器端脚本检测移动浏览器以显示移动主题.

  1. Detecting the mobile browser by server-side scripting to display mobile theme.

具有一个单独的子域,例如m.domain.com或mobile.domain.com.

Having a separate subdomain such as m.domain.com or mobile.domain.com.

哪个在行动上更好?在这两种情况下,我都认为移动搜索引擎会对移动网站进行合理索引.每种方法的优缺点是什么?

Which is better in action? In both cases, I think mobile search engines fairly index the mobile website. What are pros and cons for each method?

推荐答案

选项1:由于某些原因,它更易于使用.最大的可能是链接共享和书签同步.如果桌面浏览器上的用户共享了指向m.domain.com的链接,那么它的外观将不会很好,并且非精明的用户也会感到恼火.还有某些用户希望所有页面都处于桌面模式(即使是在其移动浏览器上),因此他们要做的就是在其移动浏览器上调整其用户代理字符串.

Option 1: This is more user-friendly for a few reasons. The biggest is probably link sharing and bookmark syncing. If a user on a desktop browser gets shared a link to a m.domain.com, it won't look very good, and non-savvy users will get annoyed. There are also certain users that prefer all pages to be in desktop mode (even on their mobile browser,) so all they need to do is adjust their user agent string on their mobile browser.

选项2:有些人觉得这比较容易,但是我无法想到现代Web开发有充分的理由. ASP.NET MVC4使得为同一URL创建单独的视图变得非常容易,并且具有在移动模式和桌面模式之间切换的简单功能.除非您找到使用它的充分理由,否则我将远离subdomain选项.

Option 2: Some people find this easier, but I can't think of a good reason for it with modern web development. ASP.NET MVC4 makes it really easy to create separate views for the same URL and there's simple functionality to switch between mobile and desktop mode. I would stay away from the subdomain option unless you find a very good reason to use it.

这篇关于如何运行网站的移动版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆