This isn't a fix for production or when application have to was shown to the client, this is only helpful when UI and Backe nd development is on different servers and in production they is actually on same server. For example:while developing UI for any application if there are a need to test it locally pointing it to backend server, In that scenario the perfect fix. For production fix, CORS headers have to is added to the backend server to allow cross Origin access.
The easy-to-just add the extension in Google Chrome to allow access using CORS.
(Https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en-US )
Just enable this extension whenever you want allow access to no ' Access-control-allow-origin ' header request.
Or
In Windows, paste the command in Run window
Chrome.exe--user-data-dir= "C:/chrome Dev Session"--disable-web-security
This would open a new Chrome browser which allow access to no ' Access-control-allow-origin ' header request.