HTML not updating javascript


#1

I have an HTML file: Main.html, and a javascript file: Canvas.js, in my workspace, and I have linked the javascript file with the HTML file using line 13 on Main.html.

The thing is when I hit run, the preview does not update when I change and save Canvas.js. When I try to do a live preview, it just shows the first label in the HTML file and nothing else.

My workspace is public and on this link:
https://ide.c9.io/ptolemy2002/canvas-library


#2

Open your browser’s console and check it out. It might provide you some useful information!

This is what it says:
GET https://preview.c9users.io/Canvas.js [HTTP/1.1 404 Not Found 33ms]
It tells you that you messed up with the URL. You want https://preview.c9users.io/ptolemy2002/canvas-library/Canvas.js instead of https://preview.c9users.io/Canvas.js .

Now, let’s take a look at your source code:
<script type="text/javascript" src="/Canvas.js"></script>

Urls are complicated. /Canvas.js means https://preview.c9users.io/Canvas.js because it starts with a /.
If you remove that /, it should work as intended. (Canvas.js) You could also put a . in front of the /. (./Canvas.js)


Also, put that <script> tag in your <body> tag.