We now have a youtube channel. Subscribe!

AJAX | Browser Support

AJAX browser support

Hello folks! welcome back to a new section of our tutorial on AJAX. In this tutorial post, we are going to be discussing about AJAX Browser Support.

All the available browsers cannot support AJAX. Following below is the list of all the major browsers that support AJAX -

  • Opera 7.6 and above.
  • Apple Safari 1.2 and above.
  • Mozilla Firefox 1.0 and above.
  • Netscape version 1.7 and above.
  • Microsoft Internet Explorer version 5 and above.
  • Konqueror.

When you write your next application, try to consider the web browsers that do not have support for AJAX.

Note: When we say that a browser does not support AJAX, it simply means that the web browser does not support the creation of a JavaScript object.

Writing Browser Specific Code

The easiest way to make your source code compatible with a browser is to make use of a try....catch blocks in your JavaScript.

      <script language = "javascript" type = "text/javascript">
         //Browser Support Code
         function ajaxFunction() {
            var ajaxRequest;  // The variable that makes Ajax possible!

            try {
               // Opera 8.0+, Firefox, Safari 
               ajaxRequest = new XMLHttpRequest();
            } catch (e) {

               // Internet Explorer Browsers
               try {
                  ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
               } catch (e) {
                  try {
                     ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                  } catch (e) {

                     // Something went wrong
                     alert("Your browser broke!");
                     return false;
      <form name = 'myForm'>
         Name: <input type = 'text' name = 'username' /> <br />
         Time: <input type = 'text' name = 'time' />

In the above JavaScript code, we tried three times to make our XMLHttpRequest object. Our first attempt -

  • ajaxRequest = new XMLHttpRequest.

It is specifically for Opera 8.0+, Firefox, and Safari web browsers. If it fails, then we try two more times to make the correct object for an Internet Explorer browser with -

  • ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
  • ajaxRequest = new ActiveXObject(Microsoft.XMLHTTP");

If it doesn't work, then we can go for a very outdated web browser that doesn't support XMLHttpRequest, which also means that it does not support AJAX.

Most likely, our variable ajaxRequest will now be set to whatever XMLHttpRequest standard the browser uses and we can start sending data to the server.

Alright guys! This is where we are going to be rounding up for this tutorial post. In our next tutorial, we are going to be discussing about AJAX Action.

Feel free to ask your questions where necessary and we will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.

Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.

Thanks for reading and bye for now.

Post a Comment

Hello dear readers! Please kindly try your best to make sure your comments comply with our comment policy guidelines. You can visit our comment policy page to view these guidelines which are clearly stated. Thank you.
© 2023 ‧ WebDesignTutorialz. All rights reserved. Developed by Jago Desain