*
The moose likes HTML, CSS and JavaScript and the fly likes Java script code for mozilla fire fox Not able to Load the xml from servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Java script code for mozilla fire fox Not able to Load the xml from servlet" Watch "Java script code for mozilla fire fox Not able to Load the xml from servlet" New topic
Author

Java script code for mozilla fire fox Not able to Load the xml from servlet

sudhin hs
Greenhorn

Joined: Nov 29, 2011
Posts: 1
function loadXMLDocs(dname)
{
var xmlDoc;
var moz = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined');


// code for IE
if (window.ActiveXObject)
{
alert("window.ActiveXObject");
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.load(dname);
return(xmlDoc);

}
// code for Mozilla, Firefox, Opera, etc.
//else if (document.implementation && document.implementation.createDocument)
else if(moz)
{
alert("Mozilla, Firefox");
xmlDoc=document.implementation.createDocument("", "", null);
xmlDoc.async=false;
xmlDoc.load(dname);
alert("xmlDoc moz:" +xmlDoc);
return(xmlDoc);
}
else
{
alert('Your browser cannot handle this script');
}

}

dname is the servlet url which bring in the xml. FOr IE it is working but for Mozilla firefox the XML not being loaded from serlet.

Any suggestion or samle code is welcome
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Java script code for mozilla fire fox Not able to Load the xml from servlet
 
Similar Threads
Converting an XML document to HTML using Javascript and HTML
parsing XML data using Javascript.
Converting an XML document to HTML using XSLT
My javascript code is working only in Internet Explorer
xmlObject