越來(lái)越多的站點(diǎn)開始使用 HTML5 標(biāo)簽了(包括淘寶也在濫用 HTML5 哈哈),好還是不好很難說(shuō)。至少對(duì)于富 JavaScript 應(yīng)用來(lái)說(shuō),使用 JavaScript 來(lái)解決 IE 下不支持 HTML5 的現(xiàn)狀是最為可靠的。
IE 下比較廣泛的 HTML5 標(biāo)簽支持方案是使用 html5shim,其使用方法如下:
<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
關(guān)于條件注釋的參考資料:http://msdn.microsoft.com/en-us/library/ms537512.aspx
WordPress 也可以通過(guò)在 header.php 文件添加這段代碼的方法實(shí)現(xiàn)。或者使用 functions.php 文件也可以:
找到當(dāng)前主題對(duì)應(yīng)的 functions.php 文件,并添加如下代碼:
function add_ie_html5_shim () { echo '<!--[if lt IE 9]>'; echo '<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>'; echo '<![endif]-->';}add_action('wp_head', 'add_ie_html5_shim');