Since Promise is not support in all IE versions, I would like to make the IE users to download a pollyfill in HTML.
<!--[if IE]>
<script src="//cdnjs.cloudflare.com/ajax/libs/es6-promise/4.1.1/es6-promise.min.js"></script>
<![endif]-->
However, conditional comments are not supported in IE 10 and 11. So the above code doesn't work in IE 10 and 11.
Then, Microsoft provide a workaround.
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9">
This make IE 10 and 11 behave like IE 9.
But my website work only in IE 10+. So this solution isn't suitable to me. Is there any other way to solve this issue?
Just use
<script>
if (typeof Promise !== "function")
document.write('<script src="//cdnjs.cloudflare.com/ajax/libs/es6-promise/4.1.1/es6-promise.min.js"><\/script>');
</script>
which does not work only for IE users, but in every environment without a native Promise implementation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With