I'm trying to read the content from a file in a request GET using Angular Cli 11.0.6, I use this code to read the file:
getFileText(url): Observable<any> {
return this.http.get(url,{ responseType: 'text'})
.pipe(
retry(1),
catchError(this.handleError)
)
}
Then I run "getFileText()" method and put the content in my view:
this.myServices.getFileText(this.url)
.subscribe((data: any) => {
this.txtcontent = data;
});
This works good when I see it from my desktop browser. But when I tested from my phone mobile browser, using the same application, it doesn't work, it shows me the error:
Error code : 0 Message: Http failure response for http://urlfile.example : 0 Uknown error
I tried changing the responseType to JSON or Blob, but it shows me the same error, Does anyone know why this happens? Thanks.