1 // NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
2 // IT'S JUST JUNK FOR OUR DOCS!
3 // ++++++++++++++++++++++++++++++++++++++++++
5 // Intended to prevent false-positive bug reports about Bootstrap not working properly in old versions of IE due to folks testing using IE's unreliable emulation modes.
9 function emulatedIEMajorVersion() {
10 var groups = /MSIE ([0-9.]+)/.exec(window.navigator.userAgent)
11 if (groups === null) {
14 var ieVersionNum = parseInt(groups[1], 10)
15 var ieMajorVersion = Math.floor(ieVersionNum)
19 function actualNonEmulatedIEMajorVersion() {
20 // Detects the actual version of IE in use, even if it's in an older-IE emulation mode.
21 // IE JavaScript conditional compilation docs: https://msdn.microsoft.com/library/121hztk3%28v=vs.94%29.aspx
22 // @cc_on docs: https://msdn.microsoft.com/library/8ka90k2e%28v=vs.94%29.aspx
23 var jscriptVersion = new Function('/*@cc_on return @_jscript_version; @*/')() // eslint-disable-line no-new-func
24 if (typeof jscriptVersion === 'undefined') {
25 return 11 // IE11+ not in emulation mode
27 if (jscriptVersion < 9) {
28 return 8 // IE8 (or lower; haven't tested on IE<8)
30 return jscriptVersion // IE9 or IE10 in any mode, or IE11 in non-IE11 mode
33 var ua = window.navigator.userAgent
34 if (ua.indexOf('Opera') > -1 || ua.indexOf('Presto') > -1) {
35 return // Opera, which might pretend to be IE
37 var emulated = emulatedIEMajorVersion()
38 if (emulated === null) {
41 var nonEmulated = actualNonEmulatedIEMajorVersion()
43 if (emulated !== nonEmulated) {
44 // eslint-disable-next-line no-alert
45 window.alert('WARNING: You appear to be using IE' + nonEmulated + ' in IE' + emulated + ' emulation mode.\nIE emulation modes can behave significantly differently from ACTUAL older versions of IE.\nPLEASE DON\'T FILE BOOTSTRAP BUGS based on testing in IE emulation modes!')