Hilfe durchsuchen

Vorsicht vor Support-Betrug: Wir fordern Sie niemals auf, eine Telefonnummer anzurufen, eine SMS an eine Telefonnummer zu senden oder persönliche Daten preiszugeben. Bitte melden Sie verdächtige Aktivitäten über die Funktion „Missbrauch melden“.

Learn More

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

  • Keine Antworten
  • 1 hat dieses Problem
  • 8 Aufrufe
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>

Geändert am von cor-el