diff options
| author | Chris Rebert <[email protected]> | 2014-04-27 22:29:14 -0700 |
|---|---|---|
| committer | Chris Rebert <[email protected]> | 2014-04-27 22:29:14 -0700 |
| commit | bde5f1fe9f837cce036821be5aaf6c40e19a8097 (patch) | |
| tree | 246f9c6b10149e62c06fa8146d4bc0a81d8a8565 /docs | |
| parent | 686a45a84be19a07e8cdab7975145417c0bd58d4 (diff) | |
| parent | a84a3693b12f549e075424a63d34a83dc19d277b (diff) | |
| download | bootstrap-bde5f1fe9f837cce036821be5aaf6c40e19a8097.tar.xz bootstrap-bde5f1fe9f837cce036821be5aaf6c40e19a8097.zip | |
Merge pull request #13422 from twbs/ie-emulation-modes-warning
Warn about IE emulation modes in docs+examples
Diffstat (limited to 'docs')
23 files changed, 95 insertions, 22 deletions
diff --git a/docs/_includes/header.html b/docs/_includes/header.html index 4eee52a3c..e12545ecc 100644 --- a/docs/_includes/header.html +++ b/docs/_includes/header.html @@ -20,7 +20,8 @@ <link href="../assets/css/docs.min.css" rel="stylesheet"> <!--[if lt IE 9]><script src="../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> -<script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> +<script src="../assets/js/ie10-viewport-bug-workaround.js"></script> +<script src="../assets/js/ie-emulation-modes-warning.js"></script> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> diff --git a/docs/assets/js/ie-emulation-modes-warning.js b/docs/assets/js/ie-emulation-modes-warning.js new file mode 100644 index 000000000..896ed6225 --- /dev/null +++ b/docs/assets/js/ie-emulation-modes-warning.js @@ -0,0 +1,51 @@ +// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT +// IT'S JUST JUNK FOR OUR DOCS! +// ++++++++++++++++++++++++++++++++++++++++++ +/*! + * Copyright 2014 Twitter, Inc. + * + * Licensed under the Creative Commons Attribution 3.0 Unported License. For + * details, see http://creativecommons.org/licenses/by/3.0/. + */ +// 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 () { + 'use strict'; + + function emulatedIEMajorVersion() { + var groups = /MSIE ([0-9.]+)/.exec(window.navigator.userAgent) + if (groups === null) { + return null + } + var ieVersionNum = parseInt(groups[1], 10) + var ieMajorVersion = Math.floor(ieVersionNum) + return ieMajorVersion + } + + function actualNonEmulatedIEMajorVersion() { + // Detects the actual version of IE in use, even if it's in an older-IE emulation mode. + // IE JavaScript conditional compilation docs: http://msdn.microsoft.com/en-us/library/ie/121hztk3(v=vs.94).aspx + // @cc_on docs: http://msdn.microsoft.com/en-us/library/ie/8ka90k2e(v=vs.94).aspx + var jscriptVersion = new Function('/*@cc_on return @_jscript_version; @*/')() // jshint ignore:line + if (jscriptVersion === undefined) { + return 11 // IE11+ not in emulation mode + } + if (jscriptVersion < 9) { + return 8 // IE8 (or lower; haven't tested on IE<8) + } + return jscriptVersion // IE9 or IE10 in any mode, or IE11 in non-IE11 mode + } + + var ua = window.navigator.userAgent + if (ua.indexOf('Opera') > -1 || ua.indexOf('Presto') > -1) { + return // Opera, which might pretend to be IE + } + var emulated = emulatedIEMajorVersion() + if (emulated === null) { + return // Not IE + } + var nonEmulated = actualNonEmulatedIEMajorVersion() + + if (emulated !== nonEmulated) { + 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!') + } +})(); diff --git a/docs/examples/blog/index.html b/docs/examples/blog/index.html index ee787c59d..314f6c1d8 100644 --- a/docs/examples/blog/index.html +++ b/docs/examples/blog/index.html @@ -16,8 +16,9 @@ <!-- Custom styles for this template --> <link href="blog.css" rel="stylesheet"> - <!-- Just for debugging purposes. Don't actually copy this line! --> + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="../../assets/js/ie-emulation-modes-warning.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> diff --git a/docs/examples/carousel/index.html b/docs/examples/carousel/index.html index 3372c87ef..828314603 100644 --- a/docs/examples/carousel/index.html +++ b/docs/examples/carousel/index.html @@ -13,8 +13,9 @@ <!-- Bootstrap core CSS --> <link href="../../dist/css/bootstrap.min.css" rel="stylesheet"> - <!-- Just for debugging purposes. Don't actually copy this line! --> + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="../../assets/js/ie-emulation-modes-warning.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> diff --git a/docs/examples/cover/index.html b/docs/examples/cover/index.html index f4765685d..26e4d6f38 100644 --- a/docs/examples/cover/index.html +++ b/docs/examples/cover/index.html @@ -16,8 +16,9 @@ <!-- Custom styles for this template --> <link href="cover.css" rel="stylesheet"> - <!-- Just for debugging purposes. Don't actually copy this line! --> + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="../../assets/js/ie-emulation-modes-warning.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> diff --git a/docs/examples/dashboard/index.html b/docs/examples/dashboard/index.html index 0b83d30d0..e14cf390c 100644 --- a/docs/examples/dashboard/index.html +++ b/docs/examples/dashboard/index.html @@ -16,8 +16,9 @@ <!-- Custom styles for this template --> <link href="dashboard.css" rel="stylesheet"> - <!-- Just for debugging purposes. Don't actually copy this line! --> + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="../../assets/js/ie-emulation-modes-warning.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> diff --git a/docs/examples/equal-height-columns/index.html b/docs/examples/equal-height-columns/index.html index b31e7bd7d..3c74c7a5c 100644 --- a/docs/examples/equal-height-columns/index.html +++ b/docs/examples/equal-height-columns/index.html @@ -16,8 +16,9 @@ <!-- Custom styles for this template --> <link href="equal-height-columns.css" rel="stylesheet"> - <!-- Just for debugging purposes. Don't actually copy this line! --> + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="../../assets/js/ie-emulation-modes-warning.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> diff --git a/docs/examples/grid/index.html b/docs/examples/grid/index.html index 7e55b5b90..3d77f358a 100644 --- a/docs/examples/grid/index.html +++ b/docs/examples/grid/index.html @@ -16,8 +16,9 @@ <!-- Custom styles for this template --> <link href="grid.css" rel="stylesheet"> - <!-- Just for debugging purposes. Don't actually copy this line! --> + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="../../assets/js/ie-emulation-modes-warning.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> diff --git a/docs/examples/jumbotron-narrow/index.html b/docs/examples/jumbotron-narrow/index.html index 372bac7e3..742fb5c62 100644 --- a/docs/examples/jumbotron-narrow/index.html +++ b/docs/examples/jumbotron-narrow/index.html @@ -16,8 +16,9 @@ <!-- Custom styles for this template --> <link href="jumbotron-narrow.css" rel="stylesheet"> - <!-- Just for debugging purposes. Don't actually copy this line! --> + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="../../assets/js/ie-emulation-modes-warning.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> diff --git a/docs/examples/jumbotron/index.html b/docs/examples/jumbotron/index.html index 9cc8ae592..ebae0a246 100644 --- a/docs/examples/jumbotron/index.html +++ b/docs/examples/jumbotron/index.html @@ -16,8 +16,9 @@ <!-- Custom styles for this template --> <link href="jumbotron.css" rel="stylesheet"> - <!-- Just for debugging purposes. Don't actually copy this line! --> + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="../../assets/js/ie-emulation-modes-warning.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> diff --git a/docs/examples/justified-nav/index.html b/docs/examples/justified-nav/index.html index 0b682cee8..c7599c1c0 100644 --- a/docs/examples/justified-nav/index.html +++ b/docs/examples/justified-nav/index.html @@ -16,8 +16,9 @@ <!-- Custom styles for this template --> <link href="justified-nav.css" rel="stylesheet"> - <!-- Just for debugging purposes. Don't actually copy this line! --> + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="../../assets/js/ie-emulation-modes-warning.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> diff --git a/docs/examples/navbar-fixed-top/index.html b/docs/examples/navbar-fixed-top/index.html index 2224c49ca..a0ab56d66 100644 --- a/docs/examples/navbar-fixed-top/index.html +++ b/docs/examples/navbar-fixed-top/index.html @@ -16,8 +16,9 @@ <!-- Custom styles for this template --> <link href="navbar-fixed-top.css" rel="stylesheet"> - <!-- Just for debugging purposes. Don't actually copy this line! --> + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="../../assets/js/ie-emulation-modes-warning.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> diff --git a/docs/examples/navbar-static-top/index.html b/docs/examples/navbar-static-top/index.html index b040d500c..6228abefe 100644 --- a/docs/examples/navbar-static-top/index.html +++ b/docs/examples/navbar-static-top/index.html @@ -16,8 +16,9 @@ <!-- Custom styles for this template --> <link href="navbar-static-top.css" rel="stylesheet"> - <!-- Just for debugging purposes. Don't actually copy this line! --> + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="../../assets/js/ie-emulation-modes-warning.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> diff --git a/docs/examples/navbar/index.html b/docs/examples/navbar/index.html index 77fbab605..81c9274e6 100644 --- a/docs/examples/navbar/index.html +++ b/docs/examples/navbar/index.html @@ -16,8 +16,9 @@ <!-- Custom styles for this template --> <link href="navbar.css" rel="stylesheet"> - <!-- Just for debugging purposes. Don't actually copy this line! --> + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="../../assets/js/ie-emulation-modes-warning.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> diff --git a/docs/examples/non-responsive/index.html b/docs/examples/non-responsive/index.html index aa95550fe..6148fcd57 100644 --- a/docs/examples/non-responsive/index.html +++ b/docs/examples/non-responsive/index.html @@ -18,8 +18,9 @@ <!-- Custom styles for this template --> <link href="non-responsive.css" rel="stylesheet"> - <!-- Just for debugging purposes. Don't actually copy this line! --> + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="../../assets/js/ie-emulation-modes-warning.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> diff --git a/docs/examples/offcanvas/index.html b/docs/examples/offcanvas/index.html index df596fdce..1df7bca9d 100644 --- a/docs/examples/offcanvas/index.html +++ b/docs/examples/offcanvas/index.html @@ -16,8 +16,9 @@ <!-- Custom styles for this template --> <link href="offcanvas.css" rel="stylesheet"> - <!-- Just for debugging purposes. Don't actually copy this line! --> + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="../../assets/js/ie-emulation-modes-warning.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> diff --git a/docs/examples/rtl/index.html b/docs/examples/rtl/index.html index 42cea4fb6..070831461 100644 --- a/docs/examples/rtl/index.html +++ b/docs/examples/rtl/index.html @@ -16,8 +16,9 @@ <!-- Custom styles for this template --> <link href="rtl.css" rel="stylesheet"> - <!-- Just for debugging purposes. Don't actually copy this line! --> + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="../../assets/js/ie-emulation-modes-warning.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> diff --git a/docs/examples/signin/index.html b/docs/examples/signin/index.html index 6a898f427..d2ae9f3aa 100644 --- a/docs/examples/signin/index.html +++ b/docs/examples/signin/index.html @@ -16,8 +16,9 @@ <!-- Custom styles for this template --> <link href="signin.css" rel="stylesheet"> - <!-- Just for debugging purposes. Don't actually copy this line! --> + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="../../assets/js/ie-emulation-modes-warning.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> diff --git a/docs/examples/starter-template/index.html b/docs/examples/starter-template/index.html index e9eb5592b..de26a02a6 100644 --- a/docs/examples/starter-template/index.html +++ b/docs/examples/starter-template/index.html @@ -16,8 +16,9 @@ <!-- Custom styles for this template --> <link href="starter-template.css" rel="stylesheet"> - <!-- Just for debugging purposes. Don't actually copy this line! --> + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="../../assets/js/ie-emulation-modes-warning.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> diff --git a/docs/examples/sticky-footer-navbar/index.html b/docs/examples/sticky-footer-navbar/index.html index 73dfe3ef0..3e2d76df2 100644 --- a/docs/examples/sticky-footer-navbar/index.html +++ b/docs/examples/sticky-footer-navbar/index.html @@ -16,8 +16,9 @@ <!-- Custom styles for this template --> <link href="sticky-footer-navbar.css" rel="stylesheet"> - <!-- Just for debugging purposes. Don't actually copy this line! --> + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="../../assets/js/ie-emulation-modes-warning.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> diff --git a/docs/examples/sticky-footer/index.html b/docs/examples/sticky-footer/index.html index f714a1383..d71aceee4 100644 --- a/docs/examples/sticky-footer/index.html +++ b/docs/examples/sticky-footer/index.html @@ -16,8 +16,9 @@ <!-- Custom styles for this template --> <link href="sticky-footer.css" rel="stylesheet"> - <!-- Just for debugging purposes. Don't actually copy this line! --> + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="../../assets/js/ie-emulation-modes-warning.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> diff --git a/docs/examples/theme/index.html b/docs/examples/theme/index.html index a2e228c84..f312df4ee 100644 --- a/docs/examples/theme/index.html +++ b/docs/examples/theme/index.html @@ -18,8 +18,9 @@ <!-- Custom styles for this template --> <link href="theme.css" rel="stylesheet"> - <!-- Just for debugging purposes. Don't actually copy this line! --> + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="../../assets/js/ie-emulation-modes-warning.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> diff --git a/docs/examples/tooltip-viewport/index.html b/docs/examples/tooltip-viewport/index.html index ccf6ef078..3bb44f3f8 100644 --- a/docs/examples/tooltip-viewport/index.html +++ b/docs/examples/tooltip-viewport/index.html @@ -16,8 +16,9 @@ <!-- Custom styles for this template --> <link href="tooltip-viewport.css" rel="stylesheet"> - <!-- Just for debugging purposes. Don't actually copy this line! --> + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="../../assets/js/ie-emulation-modes-warning.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> |
