是什么 ? | : | the defacto way to enable use of HTML5 sectioning elements in legacy Internet Explorer(IE 6-8). |
开发语言 | : | JavaScript |
源码仓库 | : | https://github.com/aFarkas/html5shiv |
jsDelivr⤵︎
<!--[if lt IE 9]>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
<![endif]-->
BootCDN⤵︎
<!--[if lt IE 9]>
<script type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<![endif]-->
step1、通过包管理器
安装html5shiv.js
包管理器 | 安装命令 |
---|---|
bower | bower install html5shiv --save |
npm | npm install html5shiv --save |
yarn | yarn add html5shiv |
step2、在HTML代码中引入JavaScript
<!--[if lt IE 9]>
<script type="text/javascript" src="/bower_components/html5shiv/dist/html5shiv.min.js"></script>
<![endif]-->
说明:考虑到IE9
是支持HTML5
的,所以,我们判断浏览器是低于IE9
才加载。
一般不需要使用它提供的那些方法,我们主要是想要使用HTML5
标准中加入的header
、footer
等语义化的标签。