I'm trying to load an external js file from my github repo here:
<html>
<body>
<h1>The script src attribute</h1>
<script type="text/javascript"
src="http://raw.githubusercontent.com/segevngr/gls-assignment/main/player.js" ></script>
</body>
</html>
The GitHub JS file:
window.myFunc = function myFunc() {
console.log("helooo")
}
When opening the HTML file im getting the following warning in console:
Cross-Origin Read Blocking (CORB) blocked cross-origin response https://raw.githubusercontent.com/segevngr/gls-assignment/main/player.js with MIME type text/plain. See https://www.chromestatus.com/feature/5629709824032768 for more details.
And when running myFunc() in devTools console i get myFunc not defined error.
Any ideas?
Via Active questions tagged javascript - Stack Overflow https://ift.tt/2FdjaAW
Comments
Post a Comment