-
Bug
-
Resolution: Fixed
-
Minor
-
3.0.2
-
Using Chrome 46.0.2490.86 on Windows.
-
MOODLE_30_STABLE
-
MOODLE_29_STABLE, MOODLE_30_STABLE
-
MDL-52835-master -
The MIME type set in the header of the output of the Javascript template from the Database activity is text/css. This is OK in most cases, but Chrome now strictly refuses to execute the Javascript because the MIME type is incorrect. The correct MIME type should be application/javascript.
Replication steps:
- Log in as teacher/admin
- Create/reuse a Database activity
- Click the Templates tab
- Click the Javascript template tab
- Add some JS, eg alert('hello');
- View the activity in Chrome
Expected result
The script will execute
Actual result
No script executes and in the browser shows an error...
Refused to execute script from 'https://XXX/mod/data/js.php?d=5' because its MIME type ('text/css') is not executable, and strict MIME type checking is enabled.
|
It looks like this change was made as part of a large issue that set MIME types for many files around Moodle. The Javascript template script MIME type was set at the same time as the CSS template scripts. It hasn't been an issue up to now as browsers have been more permissive.
The consequence is that many Database activity modules, with added Javascript, will break in Chrome.
- is a regression caused by
-
MDL-25973 add utf-8 charset to all 'Content-type' headers
- Closed