You need to use local storage to keep an variable value which shows which stages are beaten, lets say on start its set 0, when player reaches the finish line on level 1 add + 1 to the variable only once, next you will need an event that checks the value of the variable if its 1 unlock stage 2, if its 2 unlock stage 3 etc.
When the player exits the game, you will have to keep the variable in local storage so when he comes back he can continue from where he left before exiting the game.