Best way to check for IE less than 9 in JavaScript without library

前端 未结 14 1742
失恋的感觉
失恋的感觉 2020-11-28 21:10

What would be your fastest, shortest (best) way to detect browser which is IE and version less than 9 in JavaScript, without using jQuery or any add-on libraries?

14条回答
  •  隐瞒了意图╮
    2020-11-28 21:22

    I've decided to go with object detection instead.

    After reading this: http://www.quirksmode.org/js/support.html and this: http://diveintohtml5.ep.io/detect.html#canvas

    I'd use something like

    if(!!document.createElement('canvas').getContext) alert('what is needed, supported');
    

提交回复
热议问题