In this link, https://editor.p5js.org/, there are three files, html, javascript and css. I duplicate those files on my own computer and then run it with Chrome browser. It does not render anything. However, when I run this page with a web server, Xampp, it runs successfully. What are the reasons?
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/addons/p5.sound.min.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<meta charset="utf-8" />
</head>
<body>
<script src="sketch.js"></script>
</body>
</html>
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
}
html, body {
margin: 0;
padding: 0;
}
canvas {
display: block;
}