查看你的浏览器是否支持最新的HTML5标签,这里我会用自带的系统函数和Modernizr做对比
1,canvas标签的支持(提供画图功能,将取代falsh)
//自定义方法
function supports_canvas() {
return !!document.createElement('canvas').getContext;
}
//Modermizr判断 后面排版和这个一样,就不做多的声明
if (Modernizr.canvas) {
// let's draw some shapes!
} else {
// no native canvas support available
}
2,video,audio标签的支持(在网页上直接播放视频,不在需要像html4那样麻烦)
function supports_video() {
return !!document.createElement('video').canPlayType;
}
if (Modernizr.video) {
// let's play some video!
} else {
// no native video support available
// maybe check for QuickTime or Flash instead
}
3,video formats(对视频格式的支持)
function supports_webm_video() {
if (!supports_video()) { return false; }
var v = document.createElement("video");
return v.canPlayType('video/webm; codecs="vp8, vorbis"');
}
if (Modernizr.video) {
// let's play some video! but what kind?
if (Modernizr.video.ogg) {
// try Ogg Theora + Vorbis in an Ogg container
} else if (Modernizr.video.h264){
// try H.264 video + AAC audio in an MP4 container
}
}
4,Local Storage(本地信息存储,类似cookie的东西,但是cookie只允许几K,而它可以有5M)
function supports_local_storage() {
return ('localStorage' in window) && window['localStorage'] !== null;
}
if (Modernizr.localstorage) {
// window.localStorage is available!
} else {
// no native support for local storage :(
// maybe try Gears or another third-party solution
}
5,Web Workers(用于预取数据或执行其他预先操作,从而提供一个更加实时的 UI)
function supports_web_workers() {
return !!window.Worker;
}
if (Modernizr.webworkers) {
// window.Worker is available!
} else {
// no native support for web workers
// maybe try Gears or another third-party solution
}
6,Offline Web Applications(HTML5的各种本地存储方式(如本地存储和session存储)
function supports_offline() {
return !!window.applicationCache;
}
if (Modernizr.applicationcache) {
// window.applicationCache is available!
} else {
// no native support for offline
// maybe try Gears or another third-party solution
}
7,Geolocation(获取客户端当前地理位置信息)
function supports_geolocation() {
return !!navigator.geolocation;
}
if (Modernizr.geolocation) {
// let's find out where you are!
} else {
// no native geolocation support available
// maybe try Gears or another third-party solution
}
8,Input Types(新增的表单类型)
<input type="search">
<input type="number">
<input type="range">
<input type="color">
<input type="tel">
<input type="url">
<input type="email">
<input type="date">
<input type="month">
<input type="week">
<input type="time">
<input type="datetime">
<input type="datetime-local">
if (!Modernizr.inputtypes.date) {
// no native support for <input type="date">
// maybe build one yourself with
}
9,Placeholder Text(input中的替换文本,本来可以用js实现,现在可以不用写js了)
function supports_input_placeholder() {
var i = document.createElement('input');
return 'placeholder' in i;
}
if (Modernizr.input.placeholder) {
// your placeholder text should already be visible!
} else {
// no placeholder suppor
// fall back to a scripted solution
}
10,Form Autofocus(表单元素自动获得焦点)
function supports_input_autofocus() {
var i = document.createElement('input');
return 'autofocus' in i;
}
if (Modernizr.input.autofocus) {
// autofocus works!
} else {
// no autofocus support
// fall back to a scripted solution
}
分享到:
相关推荐
Judge
judge uml绘图软件 小巧
青岛大学开源 Online Judge | QQ群 496710125 。。。。。
基于PHP,实现online judge 设计.
浙江大学acm online judge 浙江大学acm online judge 浙江大学acm online judge
3.AI-Judge.rar
Online Judge Problem Code
OnlineJudge站点网址.txtOnlineJudge站点网址.txt
四川大学onlinejudge内核 c++代码 自己看看吧。。。
一款OnlineJudge程序,由CS编写
希冀平台onlineJudge使用说明
UVa Online Judge 10944 Accepted Code
Judge.m蚁群算法
成幻OnlineJudge判题代码
fzu online judge 的几道题,我的解题过程与思路,虽然都是很easy的题目,不过,重在参与嘛,哈哈
3. 具备所有Online Judge的核心判题功能,如编译代码、内存限定,时间限定,获取代码长度等; 4. 支持一道题目对应多个文件的测试方式,并支持显示每组测试文件的测试结果,计算正确率; 5. 可以打包并加密测试数据...
判断一个正数是否是质数。如果是质数,则输出“这个数是质数”;如果不是质数,则输出“这个数不是质数”。计算n的阶层以及从1的阶层到n的阶层之和。交换两个变量的值。计算一个一元二次方程的根。
一个本地的ACM测试软件
Online Judge系统(简称OJ)是一个在线的判题系统。用户可以在线提交程序多种程序(如C、C++、Pascal)源代码,系统对源代码进行编译和执行,并通过预先设计的测试数据来检验程序源代码的正确性。欢迎下载,内含源...
修复注释文本utf-8导出问题5.优化标签样式6.删除Lintcode支持版本1.1.8-始终启用单击标记按钮以获取摘要版本1.1.7-支持导入/导出文件版本1.1.6-修复Lintcode标签问题版本1.1.5-修复页面标签初始化失败问题版本1.1.4-...