Javascript file not working on github pages [duplicate]

I am able to load my javascript file on the local machine. But on github pages, it is not working.

I have included the file in index.html as

<script src="script.js" type="text/JavaScript"/>

The website is

The code is at

Any help would be appreciated. Thanks in advance.

Edit 1 I tried to add the following code in my javascript file to check if its working, but it is not working on github page and working locally.




Try this

<script src="script.js" type="text/javascript"></script>

Use closing script tag.

For more check this answer.


<script> tags need a closing tag even if they load an external script.

Your forgot it, so it tries to run </body></html> instead.

enter image description here


I think the issue is with wrong spelling.

Try this:

<script src="script.js" type="text/javascript"/>

I would advise you to move js files in a js directory on the root, following some best practices.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.