I'm investigating a very odd and randomly occurring issue in the Panel of a Kirby site (not subject of this ticket; we occasionally get a Field type "text" does not exist error showing up, which disappears simply with a hard refresh) and one of the many paths I'm looking at is browser caching. Since I noticed the following – and got sucked into the rabbit hole that is MIME type specs – I thought I'd ask:
Looking at the DevTools Network tab, it appears that all Panel JS files are loaded with MIME type application/javascript, except for /media/plugins/index.js which is loaded with MIME type application/x-javascript.
Is there a reason Kirby's Mime class uses the non-standard application/x-javascript MIME type for JS files?
If not, may I suggest (secretly hoping this could be behind that odd error I am dealing with :wink:) changing this MIME type to application/javascript in compliance with RFC4329, which discourages use of the x- prefixed experimental MIME type:
Use of experimental and unregistered media types, as listed in part above, is discouraged. The media types,
application/javascript
application/ecmascript
which are also defined in this document, are intended for common use and should be used instead.
I'm investigating a very odd and randomly occurring issue in the Panel of a Kirby site (not subject of this ticket; we occasionally get a
Field type "text" does not exist
error showing up, which disappears simply with a hard refresh) and one of the many paths I'm looking at is browser caching. Since I noticed the following – and got sucked into the rabbit hole that is MIME type specs – I thought I'd ask:Looking at the DevTools Network tab, it appears that all Panel JS files are loaded with MIME type
application/javascript
, except for/media/plugins/index.js
which is loaded with MIME typeapplication/x-javascript
.Is there a reason Kirby's
Mime
class uses the non-standardapplication/x-javascript
MIME type for JS files?https://github.com/getkirby/kirby/blob/04127160ed1ab8dc277763cd8ba4ebc5a097bc18/src/Filesystem/Mime.php#L51
If not, may I suggest (secretly hoping this could be behind that odd error I am dealing with :wink:) changing this MIME type to
application/javascript
in compliance with RFC4329, which discourages use of thex-
prefixed experimental MIME type: