html5特性检测

 

//canvas

var myCanvas = document.createElement("canvas");

if (!!myCanvas.getContext) {

//alert('support canvas api');

} else {

//alert('no support canvas api');

}

//canvas fileText

var myCanvas = document.createElement("canvas");

if (!!myCanvas.getContext) {

//get canvas content panel

var context = myCanvas.getContext('2d');

//alert(context.fillText);

//alert(typeof context.fillText);

if (typeof (context.fillText) == 'function') {

//alert('internet exploer is support canvas text api');

}

} else {

//alert('no support');

}

//video

var myVideo = document.createElement("video");

if (!!myVideo.canPlayType) {

//alert('support video api');

//detect video the specific video format

var myViedoflag = myVideo

.canPlayType('video/mp4;codecs="avc1.42E01E,mp4a.40.2"');

//alert(myViedoflag);

switch (myViedoflag) {

case 'probably':

//alert(' the internet exploer is probably support mp4');

break;

case 'maybe':

//alert(' the internet exploer is maybe support mp4');

break;

default:

//alert(' no support mp4');

break;

}

var myViedoflag = myVideo

.canPlayType('video/ogg;codecs="theora,vorbis"');

//alert(myViedoflag);

switch (myViedoflag) {

case 'probably':

//alert(' the internet exploer is probably supportogg');

break;

case 'maybe':

//alert(' the internet exploer is maybe support ogg');

break;

default:

//alert(' no support ogg');

break;

}

var myViedoflag = myVideo.canPlayType('video/webm;codecs="vp8,vorbis"');

//alert(myViedoflag);

switch (myViedoflag) {

case 'probably':

//alert(' the internet exploer is probably support webm');

break;

case 'maybe':

//alert(' the internet exploer is maybe support webm');

break;

default:

//alert(' no support webm');

break;

}

} else {

//alert('no support video api');

}

//detection detection探测,检测 local storage

if (window.localStorage) {

//alert(window.localStorage);

//alert('internet exploer is support local storage!');

} else {

//alert('internet exploer is no support local storage!');

}

//detection web Workers

if (window.Worker) {

//alert(window.Worker);

//alert('internet exploer is support Worker!');

} else {

//alert('internet exploer is no support Worker!');

}

if (window.applicationCache) {

//alert(window.applicationCache);

//alert('internet exploer is support applicationCache!');

} else {

//alert('internet exploer is no support applicationCache!');

}

if (navigator.geolocation) {

//alert(navigator.geolocation);

//alert('internet exploer is support geolocation!');

} else {

//alert('internet exploer is no support geolocation!');

}

 

 

 

 

HTML5学习笔记:

<!--[if !supportLists]-->1.       <!--[endif]-->html5特性检测

Html5特性(Y/N)

IE9

CHROME11

canvas

Y

Y

Canvas fillText

Y

Y

vedio

Y

Y

Vedio format of mp4

Y

Y

Vedio format of ogg

N

Y

Vedio format of webm

N

Y

Local storage

N

Y

Web workers

N

Y

离线web应用

N

Y

Geolocation地理位置

Y

Y

 

 

 

Html5特性(Y/N)

IE9

CHROME11

canvas

Y

Y

Canvas fillText

Y

Y

vedio

Y

Y

Vedio format of mp4

Y

Y

Vedio format of ogg

N

Y

Vedio format of webm

N

Y

Local storage

N

Y

Web workers

N

Y

离线web应用

N

Y

Geolocation地理位置

Y

Y

<input type="search" />

N

Y

<input type="number" />

N

Y

<input type="range" />

N

Y

<input type="color" />

N

N

<input type="tel" />

N

N

<input type="url" />

N

N

<input type="date" />

N

Y

<input type="email" />

N

N

<input type="month" />

N

Y

<input type="week" />

N

Y

<input type="time" />

N

Y

<input type="datetime" />

N

Y

<input type="datetime-local" />

N

Y

<input placeholder="hehehehh"/>

N

Y

<input autofocus="autofocus"/>

N

Y

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值