How To Fix Your Angular App When It’s Not Working in IE11

Using polyfills to support new features in older browsers

Ali Kamalizade
Jul 7, 2019 · 3 min read

While Internet Explorer 11 has been deprecated for a while now, Microsoft still provides security updates and technical support. However, IE11 does not support many new features which are already working in other browsers, like Google Chrome, or which will come out in the future. That’s why it’s necessary to use polyfills if you still want your application to work in IE11.

Sometimes, your application may throw errors in IE11, even when it is working fine in other browsers. There can be numerous reasons why your Angular application is not working, including:

  • Missing polyfills in polyfills.ts.
  • Using a TypeScript target version which IE11 does not support
  • Importing third-party dependencies using a TypeScript target version which IE11 does not support

Missing Polyfills for Legacy Browsers (IE11)


Differential Loading of Polyfills

  1. Add a new tsconfig-es5.app.json file.
  2. Update angular.json configuration.
  3. Run your application: ng serve --configuration es5. I recommend to add a run script in package.json for convenience.

Using unsupported JavaScript features

MDN (Mozilla Developer Network) is a great resource containing not only web development related tutorials but also JavaScript references including browser compatibility data. Can I Use provides you with both browser compatibility data and browser usage data. Using these websites you’ll be aware whether the features you use are natively supported in web browsers.

There are also static code analysis tools like linters which can let you know that this API is not available in all browsers.


How to deal with CSS issues in IE11 and older browsers?

For some properties like Flexbox there are vendor prefixes which you can use. There are tools like Autoprefixer which help you to write CSS that works in most browsers. Luckily, Angular can add vendor prefixes automatically if configured.


Conclusion

Better Programming

Advice for programmers.

Ali Kamalizade

Written by

Software Engineer @leanix_net. Co-founder of Sedeo with a passion for software engineering, SaaS and startups. I write about topics I’m interested in 🚀

Better Programming

Advice for programmers.

More From Medium

More from Better Programming

More from Better Programming

More from Better Programming

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade