How can I download a website as string with Angular4?

Viewed 731

I'm trying to download(get) a webpage which returns string, not XML and not JSON.

Basically is there any way to download a webpage as string in Angular4 like WebClient.DownloadString in C#?

Note: I thought I can use http methods(observables, promises, JSONP) to download a website at first. But anyway I tried.

I am not able to use JSONP as I understand because of it is parsing the result as json and I'm getting error because the response is string not JSON.

And observables and promises fail because I get CORS error. And I'm not sure why I'm getting CORS error because it is not a RESTful service, WCF or web api, etc..

No 'Access-Control-Allow-Origin' header is present on the requested resource.

I have also tried HttpClient but I got CORS error again.

So I believe there should be some other method or component or module in Angular to download a webpage as string.

2 Answers
Related