Is there any kind of established MIME type for OpenGL shader program source code? I know that the official IANA table doesn't seem to mention one such, so it would have to be some experimental (x-…
) or some vendor-specific (vnd.…
) subtype, probably of the text/…
main type. According to What is the correct file extension for GLSL shaders? there doesn't even seem to be an established file name extension for these, but that's a quite separate problem to me.
Background:
I sometimes want to include shader code in a <script>
tag for some WebGL application, and I want to write the type=
attribute of that tag in a way which is semantically as reasonable as possible, even though at the moment I can't think of any actuall difference such a choice would make (unless I call it text/javascript
or something similarly stupid). But nevertheless, it would be nice to be already conforming to any tools which might develop over time, building on currently established standards that I don't know about yet.
The draft glTF standard written by Khronos states to use text/plain
for GLSL files.
The following site explains in greater detail how to add a custom MIME type: https://www.xsofthost.com/help/add-and-delete-mime-type-within-cpanel/
At this link, Krhonos docs state:
External shader files may have any extension. The preferred MIME type is text/plain
.
(However, I still see errors in Chrome and Edge with shader files - specifically, "Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec." vertex.glsl:1 )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With