From much reading I conclude:
The <script> tag can store data, but it is only accessible if src is not used.
I want to use src because it is how my script-loader works.
Is the type attribute and every mime-types then useless or what?...
I have found that the "text/javascript" (same as "application/javascript") can not be accessed by .innerText or .innerHTML or .toString (hopefully I missed something here).
But it can be executed, that is the one and only thing that can be done with external <script> without browser extensions - i guess. Data is not accessible in no way because src is used?
I hope I am wrong because I want to extend my script-loader to load the mime-types that is possible to read. Is there any? Please tell me any/some accessible mime-types to dynamic load externally.
Update - Thank you for answer - Now I conclude:
The pattern <script type src> is not useful for any mime-types except Javascript, according to whatwg.org:
Setting the attribute to any other value means that the script is a data block, which is not processed. None of the script attributes (except type itself) have any effect on data blocks.
So, setting the type to any other value than for Javascript makes src having no effect and the <script> becomes a data block not so useful, because a variable as the only way to put data into it should much better store the data into a div.
Never will type and src work together in script (that would open up a security risks), because import and fetch is already the new way to load files. Script loaders may still be used where E6 import can not load on servers without CORS.
Not particularly, unless you have a
.jsonfile and the server sends the appropriate MIME type in the response header. Otherwise, the contents of the<script>tag will not be processed.Per the WHATWG specification,
A JavaScript MIME is defined as any of the following:
application/ecmascriptapplication/javascriptapplication/x-ecmascriptapplication/x-javascripttext/ecmascripttext/javascripttext/javascript1.0text/javascript1.1text/javascript1.2text/javascript1.3text/javascript1.4text/javascript1.5text/jscripttext/livescripttext/x-ecmascripttext/x-javascriptA JSON MIME is defined as
It is important to note that you must use a valid MIME type in order to guarantee browsers will never try to process it. Otherwise, future additions to the specification could break your code:
A valid MIME type is defined by the WHATWG here.