Title: Solve the compatibility problem with H5 in earlier versions of IE. Time: 2019-6-9

Compatibility processing (solve the compatibility problem of THE lower version of IE to H5)

  1. In browsers that don’t support HTML5’s new tags, the new tags will be parsed as inline elements, so we just need to convert them to blocks. However, under IE9, the new tags won’t be parsed properly. However, we can recognize custom tags created by document.createElement(‘tagName’), so our solution is to create all new HTML5 tags by document.createElement(‘tagName’). In this way, the lower version of IE can also parse HTML5 new tags properly.

  2. Processing method: In the actual development, we use more is to load a JS library of three parties by detecting the version of IE browser to solve the compatibility problem (test compatibility in IE below: the use of ieTester software)

, mainly for ie earlier versions, that is, only the earlier version of IE will be executed.

<! --[if lt IE 9]> &emsp; &emsp; <script src="js/respond.js"></script> &emsp; &emsp; <script src="js/html5shiv.min.js"></script> <! [endif] -- >Copy the code

Responder.js is intended to respond to media Query on CSS3 of Internet Explorer

Conditional comments for example

<! --[if !IE]><! -->All identifiable except IE<! - <! [endif]-->
<! --[if IE]> all IE can recognize <! [endif]-->
<! --[if IE6]> <! [endif]-->
<! --[if LTE IE6]> <! [endif]-->
<! --[if gte IE6]> <! [endif]-->
<! --[if IE7]> <! [endif]-->
<! --[if lt IE7]> <! [endif]-->
<! --[if gt IE7]> <! [endif]-->
<! --[if IE8]> <! [endif]-->
<! --[if IE9]> <! [endif]-->
Copy the code

Example:

<! -- Conditional comment IE 6.7.8 can execute, other browsers ignore this sentence -->
<! --[if lt IE 9]> <script src="js/html5shiv.min.js"></script> <! [endif]-->
Copy the code

Attachment: html5shiv.min.js file

Respond. Js file