diff options
| author | XhmikosR <[email protected]> | 2020-03-09 14:52:53 +0200 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2020-03-18 20:59:27 +0200 |
| commit | dffe600b1c0c4199b452eb73211acdf1d9460fd3 (patch) | |
| tree | 80c16d1ea5f01f18a863fa659a614fb368099018 /site/content/docs/4.3/getting-started/javascript.md | |
| parent | 9108e303ef02fbfc6befc374ed8a7469d673384b (diff) | |
| download | bootstrap-dffe600b1c0c4199b452eb73211acdf1d9460fd3.tar.xz bootstrap-dffe600b1c0c4199b452eb73211acdf1d9460fd3.zip | |
Revert "Revert "Add information about IE 11 compatibility.""
This reverts commit bcf76ef5f0d6305bb8aa7a83ae7fdc45256f7f08.
Diffstat (limited to 'site/content/docs/4.3/getting-started/javascript.md')
| -rw-r--r-- | site/content/docs/4.3/getting-started/javascript.md | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/site/content/docs/4.3/getting-started/javascript.md b/site/content/docs/4.3/getting-started/javascript.md index 3c5eecf36..f02ea5bc7 100644 --- a/site/content/docs/4.3/getting-started/javascript.md +++ b/site/content/docs/4.3/getting-started/javascript.md @@ -227,3 +227,40 @@ var tooltip = new bootstrap.Tooltip(yourTooltipEl, { } }) {{< /highlight >}} + +## Compatibility with IE 11 + +Bootstrap v5 isn't designed to work with Internet Explorer 11, but you can add the following polyfills to make it work: + +{{< highlight html >}} +<!-- Polyfill.io will load polyfills your browser needs --> +<script crossorigin="anonymous" src="https://polyfill.io/v3/polyfill.min.js"></script> +<script> + // Fix preventDefault for IE + (function () { + var workingDefaultPrevented = (function () { + var e = document.createEvent('CustomEvent') + e.initEvent('Bootstrap', true, true) + e.preventDefault() + return e.defaultPrevented + })() + + if (!workingDefaultPrevented) { + var origPreventDefault = Event.prototype.preventDefault + Event.prototype.preventDefault = function () { + if (!this.cancelable) { + return + } + + origPreventDefault.call(this) + Object.defineProperty(this, 'defaultPrevented', { + get: function () { + return true + }, + configurable: true + }) + } + } + })() +</script> +{{< /highlight >}} |
