javascript - How do I detect IE 8 with jQuery now that $.browser is deprecated? -


possible duplicate:
best way detect html5 <canvas> not supported

now $.browser is being taken out of jquery in favor of $.support, how detect ie8 jquery, or plain javascript?

if ($.browser.msie && parseint($.browser.version, 10) === 8) { alert('ie8'); } 

sorry, html not work me. can not this:

<!--[if ie 8]> <script type="text/javascript"> ie = 8; </script> <![endif]--> 

specifically, looking work canvas tag , ie8 not support canvas, jquery.support not detect canvas support.

test feature instead:

var el = document.createelement('canvas'); if (el.getcontext && el.getcontext('2d')) { // canvas supported } 

edit:

as in link suggested in comments brandon boone, here's function it:

function iscanvassupported(){ var elem = document.createelement('canvas'); return !!(elem.getcontext && elem.getcontext('2d')); } 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -