![](/img/trans.png)
[英]Function runs in Chrome but doesn't run in Firefox says function not defined
[英]angular 7 app doesn't run in firefox and runs well in chrome and edge
我的angular 7應用程序在chrome和edge上工作正常,但是由於某些原因無法在Firefox中加載,並且出現此錯誤:
錯誤:“未捕獲(承諾):HttpErrorResponse:{“ headers”:{“ normalizedNames”:{},“ lazyUpdate”:null,“ headers”:{}},“ status”:0,“ statusText”:“ Unknown Error“,” url“:null,” ok“:false,” name“:” HttpErrorResponse“,” message“:” Http失敗響應(未知url):0 Unknown Error“,” error“:{” isTrusted “:真正}}”
來自core-js。
我的依賴:
"@angular/animations": "~7.1.0",
"@angular/cdk": "^7.0.1",
"@angular/cli": "^7.1.3",
"@angular/common": "~7.1.0",
"@angular/compiler": "~7.1.0",
"@angular/core": "~7.1.0",
"@angular/forms": "~7.1.0",
"@angular/http": "~7.1.0",
"@angular/material": "^7.0.0",
"@angular/platform-browser": "~7.1.0",
"@angular/platform-browser-dynamic": "~7.1.0",
"@angular/router": "~7.1.0",
"core-js": "^2.5.4",
"rxjs": "^6.4.0"
Firefox版本是最新版本
看來這不是一個棘手的問題,而更像是服務器端。 從下一頁粘貼解決方案以避免丟失:
更改
private headers = new Headers({ 'Content-Type': 'application/json' });
至
private headers = new Headers({ 'Content-Type': '/' });
並將WebApiConfig文件中的受限xml類型設置為:
var appXmlType = config.Formatters.XmlFormatter.SupportedMediaTypes.FirstOrDefault(t => t.MediaType == "application/xml");
config.Formatters.XmlFormatter.SupportedMediaTypes.Remove(appXmlType);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.