分享更有价值
被信任是一种快乐

如何检测浏览器对HTML5和CSS3支持度

文章页正文上

HTML5CSS3HTML5CSS3!
HTML5, CSS3 CanvasWebSocket Web HTMLCSS JavaScript HTML5 HTML5 HTML5 HTML5 Web
Modernizr HTML5
Canvas

:

window.onload = function () {
if (canvasSupported()) {
alert(‘canvas supported’);
}
};
function canvasSupported() {
var canvas = document.createElement(‘canvas’);
return (canvas.getContext && canvas.getContext(‘2d’));
}

:

window.onload = function () {
if (localStorageSupported()) {
alert(‘local storage supported’);
}
};
function localStorageSupported() {
try {
return (‘localStorage’ in window && window[‘localStorage’] != null);
}
catch(e) {}
return false;
}

Modernizr
免费云主机、域名Moderizr HTML5 JS
Modernizr http://modernizr.com JS JS
2015625153003697.png (690533)
Modernizr JS

:

HTML
Modernizr CSS no-FeatureName no-flexbox chrome

:

JavaScript

:

HTML5 Boilerplate (http://html5boilerplate.com) Initializr (http://initializr.com) no-js JavaScript
HTML5 CSS3
CSS CSS

:
.boxshadow #MyContainer {
border: none;
-webkit-box-shadow: #666 1px 1px 1px;
-moz-box-shadow: #666 1px 1px 1px;
}
.no-boxshadow #MyContainer {
border: 2px solid black;
}
box-shadows boxshadow CSS no-boxshadow box-shadow
Modernizr Canvas

:
$(document).ready(function () {
if (Modernizr.canvas) {
//Add canvas code
}
if (Modernizr.localstorage) {
//Add local storage code
}
});
Modernizr CSS3

:
$(document).ready(function () {
if (Modernizr.borderradius) {
$(‘#MyDiv’).addClass(‘borderRadiusStyle’);
}
if (Modernizr.csstransforms) {
$(‘#MyDiv’).addClass(‘transformsStyle’);
}
});
Modernizr
,,shim/polyfill (shims/polyfills, https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills). Modernizr,,. Modernizr,yepnope(http://yepnopejs.com). ,,.
Modernizrload(),(test), (yep), (nope), (both). load():

:
Modernizr.load({
test: Modernizr.canvas,
yep: ‘html5CanvasAvailable.js’,
nope: ‘excanvas.js’,
both: ‘myCustomScript.js’
});
Modernizrcanvas . HTML5 canvashtml5CanvasAvailable.js myCustomScript.js (yep – load() ). , excanvas.js polyfillIE9 . excanvas.js,myCustomScript.js.
Modernizr, . , GoogleCDNModernizr. ModernizrCDNjQuery:
Google CNDjQuery. (). jQuery,jQuery. needs-jQuery.js.HTML5CSS3

相关推荐: JavaScript常见的Number对象有哪些

本篇内容主要讲解“JavaScript常见的Number对象有哪些”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“JavaScript常见的Number对象有哪些”吧!Number 对象是原始数值的包装对象。Numb…

文章页内容下
赞(0) 打赏
版权声明:本站采用知识共享、学习交流,不允许用于商业用途;文章由发布者自行承担一切责任,与本站无关。
文章页正文下
文章页评论上

云服务器、web空间可免费试用

宝塔面板主机、支持php,mysql等,SSL部署;安全高速企业专供99.999%稳定,另有高防主机、不限制内容等类型,具体可咨询QQ:360163164,Tel同微信:18905205712

主机选购导航云服务器试用

登录

找回密码

注册