Apple对浏览器嗅探的建议 [英] Apple's recommendation on browser sniffing

查看:1619
本文介绍了Apple对浏览器嗅探的建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Apple是否有任何建议使用任何技术进行浏览器嗅探(例如区分桌面IE / FF / Mobile Safari(即iPad))/其他平板电脑

Does Apple have any recommendation for using any technique for browser sniffing (e.g. to distinguish between desktop IE/ FF / Mobile Safari (i.e. iPad)) / Other tablets

我知道Apple希望我们避免使用User-agent。

I know Apple wants us to avoid using User-agent for the same.

媒体技术是否能够成为区分iPad和Xoom的简单方法?

Is the media technique foolproof way to differentiate between iPad and say Xoom?

<link rel="stylesheet" media="all and (min-device-width: 481px) and (max-device-width: 1024px)" href="ipad.css">  


推荐答案

而不是尝试检测设备/用户代理,您希望专注于检查浏览器的功能。这包括屏幕分辨率,JS支持,CSS支持等。

Rather than trying to detect device/user-agent, you want to focus on checking the capabilities of the browser. This includes screen resolution, JS support, CSS support, and more.

媒体查询只是众多技术中的一种,可以使您的网站在许多设备上正常运行。为了帮助您入门,以下是一些有用的资源:

Media queries is only one of many techniques you can employ to make your website work well across many devices. To get you started, here are a few helpful resources:

  • Modernizr - A JS library that detects browser capabilities and adds handy CSS classes and JS methods to check this
  • "Mobifying" your HTML5 site - HTML5 Rocks - An article on various techniques
  • Yiibu - a proof of concept, progressively enhanced site
  • Using media queries in the real world - Broken Links - An article promoting starting with a barebones stylesheet and then using media queries to add extra styles on top

这篇关于Apple对浏览器嗅探的建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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