Minesweeper in Javascript and Canvas

The HTML Document

We need a simple HTML document to begin with, which I'll call minesweeper.htm. This is a simple document, that requires a references to an external javascript where we'll put our game code (I'll call this minesweeper-game.js), and a Canvas element in the body, which we'll give a width and height of 300px and 400px respectively, and the ID game:

<!DOCTYPE html>

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


<canvas id="game" width="300" height="400"></canvas>

Page loaded in 0.01 second(s).