Browser Support

 

All browsers cannot support AJAX. Below is the list of browsers which support AJAX:

  • Mozilla Firefox 1.0 and above
  • Netscape version 7.1 and above
  • Apple Safari 1.2 and above.
  • Microsoft Internet Exporer 5 and above
  • Opera 7.6 and above
  • RockMelt browser

Browser – AJAX Support Check

The XMLHttpRequest object is used to exchange data with the server. Browser which has support for XMLHttpRequest should obviously support AJAX.
Here is the code snippet which checks if the browser supports AJAX or not.

<script type="text/javascript">
var xmlhttp;
function checkAJAXSupport() {
    if (window.XMLHttpRequest) { // Mozilla, Safari, ...
      xmlhttp= new XMLHttpRequest();
      alert("Yes. Your browser must be one among them - Mozilla, Safari, Chrome, Rockmelt, IE 8.0 or above");
    } else if (window.ActiveXObject) { // IE
      try {
        xmlhttp= new ActiveXObject("Msxml2.XMLHTTP");
        alert("Yes. Your browser must be IE");
      } 
      catch (e) {
        try {
          xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
          alert("Yes. Your browser must be IE");
        } 
        catch (e) {}
      }
    }
 if (!xmlhttp) {
      alert("No. Giving up Cannot create an XMLHTTP instance. Your browser is outdated!");
      return false;
    }
}
</script>


Check if your browser supports AJAX by clicking the button:

Code – Dissection

In the above Javascript code, we create XMLHttpRequest object in three different ways.

xmlhttp = new XMLHttpRequest();
is for the Mozilla, Chrome, IE 7.0+, Opera 8.0+ and Safari browsers. If that fails we attempt to create the XMLHttpRequest in other two ways which are primarily for IE browsers (below version 7.0).

xmlhttp= new ActiveXObject(“Msxml2.XMLHTTP”);
xmlhttp= new ActiveXObject(“Microsoft.XMLHTTP”);
If that doesn’t work, then browser is outdated that doesn’t support XMLHttpRequest, which also means it doesn’t support Ajax.


Author: admin

Share This Post On

Submit a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>