2014-04-25 00:27:42 +02:00
// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
2018-04-27 09:11:17 +02:00
// IT'S ALL JUST JUNK FOR OUR DOCS!
2014-04-25 00:27:42 +02:00
// ++++++++++++++++++++++++++++++++++++++++++
2017-11-19 13:30:10 +01:00
2014-04-25 00:27:42 +02:00
// 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.
( function ( ) {
2016-12-31 06:25:26 +01:00
'use strict'
2014-04-25 00:27:42 +02:00
function emulatedIEMajorVersion ( ) {
2020-05-08 18:19:14 +02:00
var groups = /MSIE ([\d.]+)/ . exec ( window . navigator . userAgent )
2014-04-25 00:27:42 +02:00
if ( groups === null ) {
2014-04-25 01:00:13 +02:00
return null
2014-04-25 00:27:42 +02:00
}
2020-06-12 20:50:30 +02:00
2014-04-25 01:00:13 +02:00
var ieVersionNum = parseInt ( groups [ 1 ] , 10 )
var ieMajorVersion = Math . floor ( ieVersionNum )
return ieMajorVersion
2014-04-25 00:27:42 +02:00
}
function actualNonEmulatedIEMajorVersion ( ) {
// Detects the actual version of IE in use, even if it's in an older-IE emulation mode.
2015-05-17 11:43:04 +02:00
// IE JavaScript conditional compilation docs: https://msdn.microsoft.com/library/121hztk3%28v=vs.94%29.aspx
// @cc_on docs: https://msdn.microsoft.com/library/8ka90k2e%28v=vs.94%29.aspx
2017-07-28 08:18:47 +02:00
var jscriptVersion = new Function ( '/*@cc_on return @_jscript_version; @*/' ) ( ) // eslint-disable-line no-new-func
2017-07-27 12:39:55 +02:00
if ( typeof jscriptVersion === 'undefined' ) {
2014-04-25 01:00:13 +02:00
return 11 // IE11+ not in emulation mode
2014-04-25 00:27:42 +02:00
}
2020-06-12 20:50:30 +02:00
2014-04-25 00:27:42 +02:00
if ( jscriptVersion < 9 ) {
2014-04-25 01:00:13 +02:00
return 8 // IE8 (or lower; haven't tested on IE<8)
2014-04-25 00:27:42 +02:00
}
2020-06-12 20:50:30 +02:00
2014-04-25 01:00:13 +02:00
return jscriptVersion // IE9 or IE10 in any mode, or IE11 in non-IE11 mode
2014-04-25 00:27:42 +02:00
}
2014-04-25 01:00:13 +02:00
var ua = window . navigator . userAgent
2014-04-25 00:27:42 +02:00
if ( ua . indexOf ( 'Opera' ) > - 1 || ua . indexOf ( 'Presto' ) > - 1 ) {
2014-04-25 01:00:13 +02:00
return // Opera, which might pretend to be IE
2014-04-25 00:27:42 +02:00
}
2020-06-12 20:50:30 +02:00
2014-04-25 01:00:13 +02:00
var emulated = emulatedIEMajorVersion ( )
2014-04-25 00:27:42 +02:00
if ( emulated === null ) {
2014-04-25 01:00:13 +02:00
return // Not IE
2014-04-25 00:27:42 +02:00
}
2020-06-12 20:50:30 +02:00
2014-04-25 01:00:13 +02:00
var nonEmulated = actualNonEmulatedIEMajorVersion ( )
2014-04-25 00:27:42 +02:00
if ( emulated !== nonEmulated ) {
2017-12-16 12:44:17 +01:00
// eslint-disable-next-line no-alert
2014-04-25 01:00:13 +02:00
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!' )
2014-04-25 00:27:42 +02:00
}
2020-06-12 20:50:30 +02:00
} ) ( )