Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Talk:Setting up your development environment for Moodle Mobile 2 (Ionic 1): Difference between revisions

From MoodleDocs
(Fixes for Cross-site scripting errors when testing with Ionic and Moodle on different IP addresses)
 
 
(No difference)

Latest revision as of 20:04, 5 April 2018

If you're running the ionic server on a different IP address to the Moodle system you're connecting the app to, then you'll find some elements of MoodleMobile are blocked by Cross-site scripting restrictions in Chromium/Chrome. To fix this you'll need to add the following to the apache config for the relevant virtual host:

Header set Access-Control-Allow-Origin "*"

Note, the above is not recommended for production systems, only do this for restricted access development sites.

Then you need to install the "Allow-Control-Allow-Origin" (CORS) extension for Chrome/Chromium. Once the extension is installed, access it's settings page and enable "Cross-origin resource sharing". On my test set up the download of remote addons was blocked until I made these changes, there were also other errors in the console relating to cross site scripting, but I didn't investigate the impact of these errors and they went away after the above changes were made.