Skip to content

Commit

Permalink
Revert "Revert "Add information about IE 11 compatibility.""
Browse files Browse the repository at this point in the history
This reverts commit bcf76ef.
  • Loading branch information
XhmikosR committed Mar 18, 2020
1 parent 9108e30 commit dffe600
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions site/content/docs/4.3/getting-started/javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 >}}

0 comments on commit dffe600

Please sign in to comment.