You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
875 B

  1. $(function () {
  2. //If IE
  3. if (detectIE()) {
  4. var version = detectIE();
  5. if (version <= 11) {
  6. $('body').addClass('IE11');
  7. }
  8. }
  9. });
  10. function detectIE() {
  11. var ua = window.navigator.userAgent;
  12. var msie = ua.indexOf('MSIE ');
  13. if (msie > 0) {
  14. // IE 10 or older => return version number
  15. return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
  16. }
  17. var trident = ua.indexOf('Trident/');
  18. if (trident > 0) {
  19. // IE 11 => return version number
  20. var rv = ua.indexOf('rv:');
  21. return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
  22. }
  23. var edge = ua.indexOf('Edge/');
  24. if (edge > 0) {
  25. // Edge (IE 12+) => return version number
  26. return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);
  27. }
  28. // other browser
  29. return false;
  30. }