modernizr

Angular 2: Check whether user's browser is compatible

情到浓时终转凉″ 提交于 2019-12-03 04:54:43
I'm writing an Angular 2 app but am conscious that some users may not be using a browser that can support Angular 2. I have a check for whether Javascript is enabled, I am more interested in whether the user's browser doesn't support certain JS/HTML5/other features required by Angular 2. What would be the best way to assess whether the user's browser supports Angular 2, and display a message if not? I'm aware of e.g. Modernizer , but not sure where to begin as Modernizer's focus seems to be on assembling compatibility checks piecemeal rather than providing a solution that checks for

If I'm already using Modernizr, will I then even need HTML5 Shiv?

狂风中的少年 提交于 2019-12-03 02:59:20
问题 1) If I'm already using Modernizr, will I then even need HTML5 Shiv to enable HTML5 tag support for IE? 2) Is HTML5 Shiv only for IE, or for all browser who don't have native HTML 5 support? Like older versions of Firefox, Safari, Chrome, etc? 回答1: 1) If I'm already using Modernizer then even will I need HTML5 Shiv to enable HTML5 tag supports for IE. You don't need to separately include html5shiv, because Modernizr includes it: As of Modernizr 1.5, this script is identical to what is used in

Can you detect if Cleartype is enabled on PC via javascript?

允我心安 提交于 2019-12-03 02:43:24
Some @font-face fonts don't play nice with non-cleartype settings (gets really choppy on the edges) Is there a way to detect this via javascript so that I can do a modernizr-style class addition to the body if cleartype is off so I can use this in my CSS In IE 6+ you can check the screen.fontSmoothingEnabled property. Otherwise you need to use an html 5 canvas to check for this. Details here . 来源: https://stackoverflow.com/questions/4328558/can-you-detect-if-cleartype-is-enabled-on-pc-via-javascript

Detect if device is iOS

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm wondering if it's possible to detect whether a browser is running on iOS, similar to how you can feature detect with Modernizr (although this is obviously device detection rather than feature detection). Normally I would favour feature detection instead, but I need to find out whether a device is iOS because of the way they handle videos as per this question YouTube API not working with iPad / iPhone / non-Flash device 回答1: Detecting iOS I am not a fan of User Agent sniffing, but here is how you would do it: var iOS = /iPad|iPhone|iPod/

Correct way to use Modernizr to detect IE?

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This might be a stupid question, but I wanted to use the Modernizr JS library to detect for some browser properties to determine what content to show or not show. I have an app called Pano2VR which outputs both HTML5 and SWF. I need the HTML5 for iOS device users. However, IE does not render this "HTML5" output at all. It seems their output uses CSS3 3D transforms and WebGL, one or more apparently unsupported in IE9. So, for those users I need to display the Flash version. I was planning to use an IFRAME and either pass the SRC via a

Modernizr with Respond.js

只谈情不闲聊 提交于 2019-12-03 01:52:10
问题 I am carefully assessing the best way to utilize Modernizr and Respond.js for responsive design and have a couple of questions for the community. Firstly, it is my understanding that when bundling Modernizr with Respond.js, no other coding or tests are required for media query support in IE8 and below. In other words, when Respond.js is bundled with Modernizr I merely have to load Modernizr in my source to get Respond.js active. Correct? Secondly, do you believe this is the most efficient way

should Modernizr file be placed in head?

只谈情不闲聊 提交于 2019-12-03 01:48:44
问题 Should the reference to the Modernizr JavaScript file be in the head of the page? I always try and place all scripts on the bottom of the page and would like to preserve this. And if it needs to be in the head, why? 回答1: If you want Modernizr to download and execute as soon as possible to prevent a FOUC, put it in the <head> From their installation guide: Drop the script tags in the <head> of your HTML. For best performance, you should have them follow after your stylesheet references. The

Three.js detect webgl support and fallback to regular canvas

匿名 (未验证) 提交于 2019-12-03 01:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Can anyone who has used three.js tell me if its possible to detect webgl support, and, if not present, fallback to a standard Canvas render? 回答1: Yes, it's possible. You can use CanvasRenderer instead of WebGLRenderer . About WebGL detection: 1) Read this WebGL wiki article: http://www.khronos.org/webgl/wiki/FAQ if (!window.WebGLRenderingContext) { // the browser doesn't even know what WebGL is window.location = "http://get.webgl.org"; } else { var canvas = document.getElementById("myCanvas"); var context = canvas.getContext("webgl"); if (

modernizr check for grayscale filters IE 10

匿名 (未验证) 提交于 2019-12-03 01:01:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: IE 10 does not support DX filters (yeaaaay) I'm currently using $.browser to detect IE 10 and implement the svg solution. However the $.browser is deprecated and will be removed or is already removed (Yeaaaay again!!!!). So, what is modernizr's alternative for $.browser in this case? filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /

How to test for mobile webkit

我是研究僧i 提交于 2019-12-03 00:33:38
I'm looking to build a new website and want to take a responsible "mobile-first" approach. One tenet of this methodology is to only load what you need, and to avoid including large wasteful libraries and frameworks until you actually need them. For this I intend to use modernizr2 to test for features and then load only required files and libraries. On the javascript side, I'm really interested in using something like zepto.js ( http://zeptojs.com/ ) which is a tiny javascript library (2-5k) optimized for mobile webkit (and mobile webkit alone) while maintaining a jquery compatible syntax. It's