特定于移动设备的视图/设备检测 [英] Mobile Specific Views / Device Detection

查看:107
本文介绍了特定于移动设备的视图/设备检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.NET Core文档中有一个标题为"Building Mobile Specific Views"的页面,但该页面正在建设中:

In the .NET Core docs there is a page titled "Building Mobile Specific Views" but is under construction: https://docs.asp.net/en/latest/mvc/views/mobile.html.

有人在构建移动视图或成功进行设备检测方面有见识吗?

Does anyone have some insight on building mobile views or successfully doing device detection?

推荐答案

基于浏览器的用户代理来提供特定视图是过时的概念,因为它不能充分说明设备的功能.例如,iPhone和iPad具有不同的屏幕尺寸,甚至移动浏览器都允许更改用户代理.

Serving specific views based on the browser's user-agent is an outdated concept as it do not sufficiently says much about the capabilities of the device. For example, iPhone and iPad come in different screen sizes and even mobile browsers allow to change the user-agent.

新概念称为响应式设计",其中一个基于可用的屏幕宽度创建一个适合和显示/隐藏某些元素的页面.一种流行的响应式设计CSS框架是 Bootstrap ,最初由Twitter开发,后来开源.

The new concept is called Responsive Design where one creates a single page that fits and show/hides certain element based on the available screen width. One popular responsive deisgn CSS Framework is Bootstrap, originally developed by Twitter and later open-sourced.

此处是响应式设计的一个示例.当您访问网站并更改浏览器的宽度时,设计也会从3更新为2到1使用浏览器或移动式导航(使用汉堡包"菜单)进行专栏设计.

Here is an example of responsive design. When you go to the site and change the width of your browser, the design updates as well from 3 to 2 to 1 column design with browser or mobile like navigation (with the Hamburger menu).

这篇关于特定于移动设备的视图/设备检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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