Office docs/PDF not opening with Chrome on Android mobiles (M2.7)

Office docs/PDF not opening with Chrome on Android mobiles (M2.7)

by Richard Semmens -
Number of replies: 3

Word/Excel/PPT and PDF docs can be downloaded by Android mobiles/tables from our site, but the files can then not be opened if using Chrome browser. Firefox browser on Android works properly, and iphones are not affected.

In Chrome, the documents download successfully, but when the item if selected from the mobile's notification menu, Chrome just gives a "Can't open file" message.

Is this a Moodle issue? An Android issue?

Average of ratings: -
In reply to Richard Semmens

Re: Office docs/PDF not opening with Chrome on Android mobiles (M2.7)

by Andrew Normore -

I very much doubt it's a Moodle issue. If the file is working on other browsers, the file is 99.999999% OK. 

I recommend trying on a different Android app. 

Actually, I have an Android. I can confirm that since I don't have an actual PDF browser on my phone, the PDF's I download from Gmail won't open half the time, or look stupid. 

Hope this helps.

In reply to Andrew Normore

Re: Office docs/PDF not opening with Chrome on Android mobiles (M2.7)

by Richard Semmens -

Found the problem - documents set to "Force Download" won't open. But set them to "Automatic" and they behave. Something to do with the "wrong mime type being sent with the file" apparently.

At least I can keep my students happy now ...

In reply to Richard Semmens

Re: Office docs/PDF not opening with Chrome on Android mobiles (M2.7)

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Richard,
could you post the complete list of those file extensions not working under "Force download" option using mobile Chrome on Android from your experience?

Moodle already manages many MIME types e.g. docx (https://github.com/moodle/moodle/blob/9528f643d1dd02896bc8326ae63b4220d55780e9/lib/filelib.php#L1418) and "Force download"  changes the content disposition header from inline to attachment but there are issues on Android Chrome e.g. https://code.google.com/p/android/issues/detail?id=11422 or other telling about the file extension to be in upper case if you want to download it in old Android versions.

Having the full list of those extensions will help others reading this thread first and maybe Devs will try to understand if Moodle could do something to mitigate this Android Chrome issue.

For example, here is my first proposal: you could try to change the line at https://github.com/moodle/moodle/blob/9528f643d1dd02896bc8326ae63b4220d55780e9/lib/filelib.php#L2265 forcing $isFF always to true to see if sending the right MIME type and not the fake application/x-forcedownload will solve your issue.

Waiting for your feedback, I'll try to understand the historical reasons for that Moodle check since IMHO it is not correct regardless, potentially, only mobile Chrome complains about it: indeed, if the aim is to force HTML files download it should be limited to that case. This is IMHO a bug and, if confirmed from you, I'll be happy to open an issue into the Tracker and propose a fix for it.

TIA,
Matteo