-
Sub-task
-
Resolution: Fixed
-
Major
-
2.0
-
None
-
MOODLE_20_STABLE
-
MOODLE_20_STABLE
Currently Moodle does not provide blocks, filters or modules with an effective way of inserting javascript or css into the html header.
It is possible to insert javascript by adding javascript.php to the root folder of a block,filter or module. However, the file is included as raw text - it is not parsed PHP.
I have developed a modification to moodle which enables blocks, filters and modules to insert javascript / css into the html header whilst taking account of user permissions, browser version and edit mode. This has the following advantages:
1) Standards compliance - all linked css and scripts should be in the head of the document, not the body
2) Because css and javascript are included in the head according to user permissions, there is no wasted bandwidth for users who should not 'see' such css or javascript (way better than the current lib/javascript-mod.php which simply includes everything)
3) Security - users should not be aware of javascript that is not relevant to them based on their permissions. This is not a major security risk but every little helps!
Please visit the following screen cast for more info (I recommend the high quality link)
High quality link:
http://ossett.schools.wakefield.gov.uk/web/media/video/moodle_mod_screencast_hq
Low quality link:
http://ossett.schools.wakefield.gov.uk/web/media/video/moodle_mod_screencast