3 Solutions for Supporting Internet Explorer
2014-03-29 23:21
225 查看
3 Solutions for Supporting Internet Explorer
Written by David Walsh on February 10, 2014 · 33Comments
In the beginning, Internet Explorer was the progressive browser. After a period of inactivity, Internet Explorer became the bane of our existence. Microsoft has since recommitted to their browser but the fact remains that sometimes modern Internet Explorer is
lagging just a bit behind WebKit-based browsers and Firefox. We also need to accommodate for earlier versions of IE. The following will allow your sites to quickly and almost magically work better in Microsoft's flagship browser!
htmlshiv.js
Remy's HTML5shiv creates HTML5 elements like main, header, footer, etc.via JavaScript. Somehow creating said elements via JavaScript communicates that they are styleable. We can think for days about why it works but who cares? This crutch is still a must-use on all production sites./
<!--[if lt IE 9]> <script src="dist/html5shiv.js"></script> <![endif]-->
selectivizr.js
Selectivizr.js is an incredible resource, polyfilling loads of unsupported CSS selectorsand properties, including the all-important
last-child. On a recent redesign,
I was able to plug selectivizr in and not miss a beat in older Internet Explorers. Here's how I implemented it:
<!--[if lte IE 8]><script src="js/libs/selectivizr.js"></script><![endif]-->
An absolute must for your modern projects. Only loaded for old IE's
<html> Conditional Comments
The ugliest conditional comment series you'll ever see. Ever. But ugly or not, the fact remains that this code workers exactly as intended:<!DOCTYPE html> <!--[if lt IE 7 ]> <html class="ie6" lang="en"> <![endif]--> <!--[if IE 7 ]> <html class="ie7" lang="en"> <![endif]--> <!--[if IE 8 ]> <html class="ie8" lang="en"> <![endif]--> <!--[if IE 9 ]> <html class="ie9" lang="en"> <![endif]--> <!--[if (gt IE 9)|!(IE)]><!--> <html lang="en"> <!--<![endif]-->
This snippet doesn't require or wait on JavaScript, and isn't near the weight of a JavaScript library. Your styles for defined classes are immediately enacted and there's no flash of unstyled content.
While Internet Explorer is catching up to its competitors, the fact remains that their old browsers are still relatively popular, especially in developing countries. The good news is that these resources work in all of those browsers and are not expensive
in modern browsers!
相关文章推荐
- 反射得到指定属性值
- 左连接、右连接、交叉连接、全外连接
- Unity3D 利用NGUI2.6.3做技能冷却的CD效果
- java socket编程
- void main 与 int main的区别
- POST 与 GET 区别
- Oracle Linux
- PDF 补丁丁 0.4.1.804 测试版发布:合并文件夹的图片和PDF文件,自由生成多层次书签
- 第一个Android应用 扫描宝 欲挑战传统扫描枪
- he comes
- 投影纹理映射(Projective Texture Mapping)详解
- Android学习之button
- 昨天踩到一坨臭狗屎(与无损压缩有关)
- 004_008 Python 行转化成列,列转化成行
- VS2012加载项目失败解决办法
- auto layout on ios versions prior to 6.0
- HighCharts之2D柱状图、折线图和饼图的组合图
- Android学习之EditText
- HighCharts之2D柱状图、折线图和饼图的组合图
- 线上环境部署MongoDB的官方建议