Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Cuireadh an snáithe seo sa chartlann. Cuir ceist nua má tá cabhair uait.

firefox shows xml parse error while loading a xml in html file, while chrome works fine

  • Gan freagra
  • 1 leis an bhfadhb seo
  • 8 views
more options

I am trying to load a xml file in html file in firefox, everytime it shows xml parse error, location index.html, line 1 column 39. While in chrome works fine.

HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 <meta charset="utf-8" />
</head> 

the JS CODE:

 $.ajax({
    type: 'POST',
    xhrFields: {
      responseType: 'blob'
    },
    dataType: 'binary',
    url: 'wf/Ad/export?cr=' + cr,
    data: wfdName,
    contentType: 'application/text;charset=utf-8',
    dataType: "binary",
    success: function(data) {
      var fileName = wfdName+".xml" //if you have the fileName header available
      if(window.navigator.msSaveOrOpenBlob){
        var blob = new Blob([data], { type: "text/plain"});
        window.navigator.msSaveOrOpenBlob(blob, fileName); 
      }else{
        $("#download-link").prop("href",window.URL.createObjectURL(data));
        $("#download-link").prop("download",fileName);
        $("#download-link")[0].click();
      }
    },
    error: function(jqXHR, textStatus, errorThrown) {
      console.log(errorThrown);
      console.log(jqXHR.responseText);
      var msg = 'Failed to export';
      showNotification(false, msg, 0);
}
I am trying to load a xml file in html file in firefox, everytime it shows xml parse error, location index.html, line 1 column 39. While in chrome works fine. HTML: <pre><nowiki> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /> </head> </nowiki></pre><br> the JS CODE: <pre><nowiki> $.ajax({ type: 'POST', xhrFields: { responseType: 'blob' }, dataType: 'binary', url: 'wf/Ad/export?cr=' + cr, data: wfdName, contentType: 'application/text;charset=utf-8', dataType: "binary", success: function(data) { var fileName = wfdName+".xml" //if you have the fileName header available if(window.navigator.msSaveOrOpenBlob){ var blob = new Blob([data], { type: "text/plain"}); window.navigator.msSaveOrOpenBlob(blob, fileName); }else{ $("#download-link").prop("href",window.URL.createObjectURL(data)); $("#download-link").prop("download",fileName); $("#download-link")[0].click(); } }, error: function(jqXHR, textStatus, errorThrown) { console.log(errorThrown); console.log(jqXHR.responseText); var msg = 'Failed to export'; showNotification(false, msg, 0); }</nowiki></pre>

Athraithe ag cor-el ar