The liveserver used by your development environment (editor), reloads the webpage when any file in your project directory tree is modified or created.
Run your code without liveserver, if you don't want your page to reload when you save the canvas.
Or save the file somewhere outside (i.e. above) the project directory.