You can navigate to another URL by setting the variable
window.location.href = url or with the function
The difference between the two methods is how the browser's back-button will behave. The first one will generate a separate navigation history entry for each level while the second one will not.
But, you should consider if making each level an own HTML document is really a good architecture. It will cause a variety of problems:
- Technical complications with passing data between two levels.
- Long loading times on level changes, because the whole game needs to be reloaded from the server.
- It makes development more tedious, because when you change something, you might have to make the change to the files of every single level.
- Each level having its own URL will allow players to bypass your level navigation by sharing the URLs to later levels
For these reasons, you should look into ways to create your game as a single-page application. When the player completed a level, load the data for the next level and switch out the level without leaving the application.