Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Although usage of early versions of Internet Explorer have dropped dramatically in the last few years, it's still important to know how to run AJAX requests that are compatible with those systems. And actually, the whole concept behind XHR requests was created by Microsoft and implemented first in a browser in IE5. To accomplish this, Microsoft used a technology called ActiveX. Because ActiveX was not available to other browsers like Safari, Firefox, and Chrome, they created a different implementation of the API using the XMLHttpRequest object.
Since ActiveX was seen as a proprietary implementation, the XMLHttpRequest object became the standard. So like with a lot of other web technologies, we've ended up with a fragmented implementation when trying to support older browsers. Luckily, all we have to do to support these browsers is to check if the browser API has an XHR object. So first, I'm going to change this line right here to just create the variable. Now I'm going to use an if statement.
So if the browser's API has the XMLHttpRequest object, then I'm going to set the request variable to this new object; otherwise, we'll check for the ActiveX object. The rest of our code is not going to change and our AJAX code should execute in the same manner. just refresh the page. You see that the page looks exactly the same, but my code is now more compatible with older browsers.
So even though you might not run into a situation in which you have to support really old browsers, it's good to know that doing it takes just a few lines of code.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 97508 Viewers
61 Video lessons · 84747 Viewers
71 Video lessons · 68923 Viewers
56 Video lessons · 101377 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.