But sometimes you need that kind of access, for example when developing an HTML based mobile app that retrieves dynamic content from a web server. In that scenario the web pages are run locally in the mobile device (smartphone or tablet) and they make requests and posts to your remote web server, which is by default not allowed.
You can go around this by just modifying the web server response to include the Access-Control-Allow-Origin header with a valid origin value. For example:
Will allow all requests from all origins.
You can configure this to be sent on the desired requests on your web server, or you can just add the header programatically on each page/service you need, for example in PHP you can just add:
<?php header('Access-Control-Allow-Origin: *'); ?>