< Prev :Contents: Next >

Internet Explorer and Mozilla Firefox

As always, there is a difference in the script you write for Microsoft Internet explorer and Mozilla Firefox or Netscape Navigator or other Mozilla based browser or any other JavaScript enabled browser.  In Internet Explorer, the code to obtain an instance of XmlHttp is:

new ActiveXObject("Msxml2.XMLHTTP")


new ActiveXObject("Microsoft.XMLHTTP")

The first one is used in the newer versions and the second one works with older IE browsers (5.0+). For Mozilla browsers you instantiate an XmlHttpRequest like so:

new XMLHttpRequest() 

There is also another method to fetch an XML document. That is by using document.implementation in Mozilla and using XMLDOM for IE. The code for doing that is:

// Mozilla architecture
document.implementation.createDocument("", "", null)
//Internet Explorer
new ActiveXObject("Microsoft.XMLDOM")

I do not discuss this method here. It is basically for just loading an xml document without sending data in the request. But you can still easily send GET data.

Creative Commons License This work is licenced under a Creative Commons Licence. More details in the content page.

< Prev :Contents: Next >