我有在 IE 中工作但在其他浏览器中不工作的功能请帮助重写它以实现跨浏览器兼容性
function Fetch(xml) {
var Xml = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">";
Xml += GenerateAuthenticationHeader();
Xml += "<soap:Body>";
Xml += "<Fetch xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">";
Xml += "<fetchXml>";
Xml += CrmEncodeDecode.CrmXmlEncode(xml); // Microsoft _HtmlEncode function
Xml += "</fetchXml>";
Xml += "</Fetch>";
Xml += "</soap:Body>";
Xml += "</soap:Envelope>";
// Microsot CreateXmlHttp function
if ( XMLHttpRequest != null){
var XmlHttp = new XMLHttpRequest();
}
else{
var XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
XmlHttp.open("POST", "/mscrmservices/2007/crmservice.asmx", false); //Sync Request
XmlHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
XmlHttp.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Fetch");
XmlHttp.send(Xml);
var ie = (window.ActiveXObject) ? true : false;
var XmlDoc = (ie) ? new ActiveXObject("MSXML2.DOMDocument") : new window.XMLHttpRequest();
XmlDoc.async = false;
XmlDoc.resolveExternals = false;
XmlDoc.loadXML(XmlHttp.responseXML.text);
return XmlDoc;
}
如何更改代码以使其在谷歌浏览器中工作