From the course: JavaScript: Enhancing the DOM
Cross-browser compatibility
From the course: JavaScript: Enhancing the DOM
Cross-browser compatibility
- [Instructor] Let's talk about a challenge as old as the web itself, cross-browser compatibility. It's the art of making sure your web application works smoothly across different browsers and different versions of browsers. Imagine hosting a party where your guests have various dietary preferences, just like you've catered to all their tastes, your web application should cater to different browsers' quirks and features. You can use tools to see whether a JavaScript feature is supported across browsers. You could use tools like Can I Use to check browser support for various features. For example, if I click on Flexbox, you can see here which browsers do and don't support it. There's also statistics to see how much browsers cover this feature. You can also code defensively. For example, here on line five, I'm first going to check if fetch is supported, and if that's not the case, I'm going to say it's not supported in the browser as a message to the user instead, this avoids some nasty errors. You have to make sure that your app delivers a consistent experience to all users, even the ones with somewhat old browsers, regardless of their choice of browsers, well, mostly. At this point, it's not expected that your app works with Internet Explorer, thankfully. Next up is your challenge for this module.