I got an html file that looks somewhat like this:
<html>
<head>
<script type="text/javascript" src="lang-parser.js"></script>
<script id="code" type="text/some-scripting-language">
//some code here in some language that is not js
</script>
<script type="text/javascript" src="sketch.js"></script>
</head>
<body>
<div id="canvas"></div>
</body>
</html>
Everything works and seems fine. Now I take the code in the middle script and move it into another file, and change the html code for that to:
<script id="code" src="code.cdy" type="text/some-scripting-language"></script>
and it stops working, without any explicit errors, as if the script didn't load in time or something.
My question is: what can be the reason for this behavior and how can I change it?
Notes:
text/javascript
(which it is not), when the console finally informs me the file doesn't exist.Because the lang parser js does not see the contents of your script because the element with id 'code' is empty, and the src tag does not mean anything to it