Totara Learn Open Discussions

HTML files force downloaded / blank content

 
Ulises Avendaño Cano
HTML files force downloaded / blank content
by Ulises Avendaño Cano - Wednesday, 5 March 2025, 11:55 AM
Group Partners

Hello community,

I'm having a problem opening html files in a course. I tried to upload an html file via a file resource item, but no matter how I set the Appearance-Display to 'Embed', 'Open' or 'In Popup', the html file always downloads automatically and all I can see is a blank box or a popup.

I already did what I found in the documentation:

https://totara.help/docs/embed-advanced-html

I already activated the Disable constant cleaning option and added this in my config.php file $CFG->disable_forced_html_download = 1;

however it still doesn't work.

Will this feature no longer be available in totara 19?

in totara 18 it worked fine


Craig Eves
Re: HTML files force downloaded / blank content
by Craig Eves (Totara Support) - Wednesday, 12 March 2025, 6:49 PM
Group Totara

Hi Ulises

There is a note added further down in the help that outlines a change of behaviour for html files in a course and a way of reverting the behavour if required

A security patch in version 19 changed the behaviour of HTML files in courses. Any embedded HTML you have added to a course using the file resource will now be downloaded instead of being viewed on the page. If you need to revert to the previous behaviour you will need to disable consistent cleaning (see above), then set the $CFG->allow_inline_uploaded_html = 1; flag in config.php. We do not recommend using this flag unless it is critical to your site's operation. If enabled, a warning will appear in the site's security report.

Regards


Ulises Avendaño Cano
Re: HTML files force downloaded / blank content
by Ulises Avendaño Cano - Thursday, 13 March 2025, 9:25 AM
Group Partners

Hello Craig, thank you for your response.

Adding the line: $CFG->allow_inline_uploaded_html = 1;

works as expected. Just as a note, the documentation provides a different setting.

Regards

Craig Eves
Re: HTML files force downloaded / blank content
by Craig Eves (Totara Support) - Thursday, 13 March 2025, 3:07 PM
Group Totara

Hi Ulises

Thanks for confirming this works - I think the documentation has been recently updated too include this new setting .

Regards