If I'm already using Modernizr, will I then ev

2019-03-08 13:01发布

1) If I'm already using Modernizr, will I then even need HTML5 Shiv to enable HTML5 tag support for IE?

2) Is HTML5 Shiv only for IE, or for all browser who don't have native HTML 5 support? Like older versions of Firefox, Safari, Chrome, etc?

1条回答
Root(大扎)
2楼-- · 2019-03-08 13:28

1) If I'm already using Modernizer then even will I need HTML5 Shiv to enable HTML5 tag supports for IE.

You don't need to separately include html5shiv, because Modernizr includes it:

As of Modernizr 1.5, this script is identical to what is used in the popular html5shim/html5shiv library.

http://www.modernizr.com/docs/#html5inie


2) and is HTML5 Shiv only for IE or for all browser who don't have native HTML 5 support. like older version of Firefox, Safari, Chrome etc.

It's only for Internet Explorer.

Older versions of other browsers don't need it: http://caniuse.com/html5semantic

And the recommended snippet to include it is:

<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

Which will only ever run for IE less than 9.

查看更多
登录 后发表回答