0

I have coded a site that is jquery heavy (animations, css state changes etc) that works perfectly on firefox, but has issues executing the jquery for IE. What I was wondering was is there a way of the jquery code automatically disabling when the site is viewed using IE?

Sam Friday Welch
  • 265
  • 2
  • 4
  • 14
  • possible duplicate: http://stackoverflow.com/questions/10964966/detect-ie-version-in-javascript – tobspr Jul 28 '13 at 12:42

2 Answers2

1

Sure, you can use conditional comments in the head section of your page to include jQuery only for browsers that isn't IE :

<!--[if !IE]> -->
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- <![endif]-->

conditional comments

adeneo
  • 312,895
  • 29
  • 395
  • 388
0

You might use a browser detect plugin, like that: Browser detect

For simple purposes, you could use:

function isIE () {
  var myNav = navigator.userAgent.toLowerCase();
  return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : false;
}

if (isIE()) {
    // no jquery
}

(from Detect IE version (prior to v9) in JavaScript)

Community
  • 1
  • 1
tobspr
  • 8,200
  • 5
  • 33
  • 46