Mobile app CSS / CORS Policy

Mobile app CSS / CORS Policy

by Nolan Boisel -
Number of replies: 4

Hello guys,

I hope that i'm posting this in the right place.

As the title mention, i have a problem with customising the moodle mobile app with a CSS stylesheet. I tried to put the stylesheet in moodle/theme/mytheme/style and moodle/theme folder and added the URL to that stylesheet in the admin > mobile appearance part.

But when i go on my phone, there are no modifications at all. I tried on https://integration.apps.moodledemo.net/ and there, i saw that the stylesheet is blocked due to missing header about CORS policy.

So i then added in webservice/upload.php and webservice/lib.php those lines of code: 

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: *');

But it still doesn't work. Can someone help me with this please

Average of ratings: -
In reply to Nolan Boisel

Re: Mobile app CSS / CORS Policy

by Noel De Martin -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hi there,

It should work on integration.apps.moodledemo.net, if you are having some problems with CORS make sure to check out the Using the Moodle App in a browser page.

Also, you may already be aware of this, but just in case keep in mind that this will not work in the application you can find in the appstores if you haven't purchased a Moodle App plan.

In reply to Noel De Martin

Re: Mobile app CSS / CORS Policy

by Nolan Boisel -
Hello Noel,

Thank you for your reply !

Oh okay, so the CORS policy problem is just because i try the app on a browser, but if i can't customise the app it's because i didn't purchase a Moodle App Plan. ( Since the app i tried on my phone is indeed from the Google play store ).

Well i wasn't aware of this, i think i read the wrong doc (https://docs.moodle.org/dev/Moodle_App_Customization instead of https://docs.moodle.org/dev/Moodle_App_Remote_Themes which state this in the first lines).
In reply to Nolan Boisel

Re: Mobile app CSS / CORS Policy

by Noel De Martin -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

We're in the process of updating the docs and just now I added this in that first document as well, sorry for the confusion.

In reply to Noel De Martin

Re: Mobile app CSS / CORS Policy

by Nolan Boisel -
No worries, thank you very much for the help Noel !

Have a good day 🖐️