ie8 html5 超炫轮回码,IE8的Strong HTML5 support

印象中IE8是不支持HTML5的,后来零零碎碎看到部分HTML5支持,今天特意归档一下,看看IE8到底支持多少HTML5, stackoverflow上有人说,IE8在当年发布时,Microsoft承诺:With full CSS 2.1, strong HTML 5 support ,参见:http://msdn.microsoft.com/en-us/library/cc288472 。full CSS2.1 没问题,这个strong HTML5 support 到底在哪里?为此特意去Microsoft官方摘录一下:

1.网络离线检测:window.navigator.onLine

if(!window.navigator.onLine){

alert('offline');

}

2.本地存储:window.localStorage

if( 'localStorage' in window && null != window.localStorage ){

localStorage.setItem('test', 'hello world');

alert(localStorage.getItem('test'));

localStorage.removeItem('test');

}

3.Ajax跨域请求 XDomainRequest() ,仅IE8+支持,其他浏览器的XMLHttpRequest对象内置支持跨域请求。

if('XDomainRequest' in window && null != window.XDomainRequest){

// test

/* 使用方法同 XMLHttpRequest对象

var rq = new XDomainRequest();

rq.onload = function(){};

rq.open('GET', 'http://www.example.com/');

rq.send();

*/

alert('support XDomainRequest');

} 4.跨文档消息传输:postMessage()

window.top.postMessage('hello, from cross domain iframe message', 'http://www.example.com');

5.本地JSON对象支持:JSON 两个方法:JSON.stringify(); JSON.parse();

if('JSON' in window && null!=window.JSON){

alert(JSON.parse( JSON.stringify({'hello': 'world'}) )['hello']);

}

6.Ajax链接 前进后退支持:window.onhashchange()

7.CSS选择器:document.querySelectorAll(); // 一直以为不支持!

果然是非常strong的support啊。

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值