]>
git.ipfire.org Git - ipfire.org.git/blob - src/scss/bootstrap-4.0.0-alpha.6/docs/assets/js/ie-emulation-modes-warning.js
1 // NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
2 // IT'S JUST JUNK FOR OUR DOCS!
3 // ++++++++++++++++++++++++++++++++++++++++++
5 * Copyright 2014-2015 The Bootstrap Authors
6 * Copyright 2014-2015 Twitter, Inc.
8 * Licensed under the Creative Commons Attribution 3.0 Unported License. For
9 * details, see https://creativecommons.org/licenses/by/3.0/.
11 // 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.
15 function emulatedIEMajorVersion () {
16 var groups
= /MSIE ([0-9.]+)/ . exec ( window
. navigator
. userAgent
)
17 if ( groups
=== null ) {
20 var ieVersionNum
= parseInt ( groups
[ 1 ], 10 )
21 var ieMajorVersion
= Math
. floor ( ieVersionNum
)
25 function actualNonEmulatedIEMajorVersion () {
26 // Detects the actual version of IE in use, even if it's in an older-IE emulation mode.
27 // IE JavaScript conditional compilation docs: https://msdn.microsoft.com/library/121hztk3%28v=vs.94%29.aspx
28 // @cc_on docs: https://msdn.microsoft.com/library/8ka90k2e%28v=vs.94%29.aspx
29 var jscriptVersion
= new Function ( '/*@cc_on return @_jscript_version; @*/' )()
30 if ( jscriptVersion
=== undefined ) {
31 return 11 // IE11+ not in emulation mode
33 if ( jscriptVersion
< 9 ) {
34 return 8 // IE8 (or lower; haven't tested on IE<8)
36 return jscriptVersion
// IE9 or IE10 in any mode, or IE11 in non-IE11 mode
39 var ua
= window
. navigator
. userAgent
40 if ( ua
. indexOf ( 'Opera' ) > - 1 || ua
. indexOf ( 'Presto' ) > - 1 ) {
41 return // Opera, which might pretend to be IE
43 var emulated
= emulatedIEMajorVersion ()
44 if ( emulated
=== null ) {
47 var nonEmulated
= actualNonEmulatedIEMajorVersion ()
49 if ( emulated
!== nonEmulated
) {
50 window
. alert ( 'WARNING: You appear to be using IE' + nonEmulated
+ ' in IE' + emulated
+ ' emulation mode. \n IE emulation modes can behave significantly differently from ACTUAL older versions of IE. \n PLEASE DON \' T FILE BOOTSTRAP BUGS based on testing in IE emulation modes!' )