I am trying to run a simple application. I have an Express backend which returns a JSON string when visited at localhost:4201/ticker
. When I run the server and
XMLHttpRequest cannot load localhost:4201/ticker. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
Any time you see that “only supported for protocol schemes” message, it almost certainly means you’ve just forgotten to put the https
or http
on the request URL in your code.
So in this case, the fix is to use the URL http://localhost:4201/ticker
in your code here:
this._baseUrl = 'http://localhost:4201/';
…because without the http://
there, localhost:4201/ticker
isn’t really the URL you intend.