So I have this really basic js script linked in the HTML, it gives no errors when i try to run it but it just doesn't do what it's supposed to. Here's the code:
var canvas = document.getElementById("canvas"),
c = canvas.getContext("2d"),
width = canvas.width = window.innerWidth,
height = canvas.height = window.innerHeight;
c.fillRect(0, 0, 50, 50);
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript' src='main.js'></script>
</head>
<body>
<canvas id='canvas'></canvas>
</body>
</html>
This should just draw a square in the top-left corner, but it does nothing. It was originally a quite large file, but i reduced it to this just as a proof of concept. As you can see, the snippet works, but chrome doesn't.