I agree with Phillip that most of the time, people messing with the code is only going to hurt their own experience. He mentioned multiplayer as an exception to this, but I would also add in-game purchases (like with real money, not game currency), but it doesn't sound like you are going in that direction. A third way it might affect others is if you have some difficult-to-get unlock-able content that you want the player community to struggle to discover some time after the initial release of the game. Most games don't even bother trying to hide things like that, with maybe the exception of some MMORPGs.
Even if those things don't concern you, your current approach still has its benefits. Since the game is designed to run in a browser, your target players would get impatient in the case of a long initial download. Console and standalone PC games can get away with having the player download everything at once because they only need to do it once. With web development, though, you need to assume that everything goes away when you close your browser. Sure, the game could be cached, but you can't count on that.
On the other hand, it would get annoying having to wait a couple seconds between when you unlock something and when it is actually download it. It can definitely get messy on the programming side, since certain gameplay cannot happen until a download completes, and you don't know exactly when or if the download will happen.
Manage downloads by predicting unlocks.
To keep downloads from getting in the way of the game, you can predict what content will be unlocked next, and then begin the download before it is ever unlocked. It sounds messy, but it doesn't have to be. Just do the following:
- Start the game with an initial list of unlockables. Since this list is only the names, or even just the IDs of them, it won't slow things down significantly at the start.
- Each unlockable is assigned an initial state of "not downloaded" and "locked."
- As soon as the game launches, the thing most likely to be unlocked first (probably the first thing on the list) begins to download in the background.
- The thing will almost definitely download before it is unlocked. Set the status of the thing to "downloaded"
- When the player actually does unlock the thing, set the status to "unlocked." Since it has a status of both "unlocked" and "downloaded," it is allowed to appear in the game menus. At this time, trigger the download of the thing most likely to be unlocked next, and repeat steps 4 and 5.
In the case that the player is really fast, or the download is really slow, you will, of course, need to block access to it from the menus until it is also downloaded. Depending on how you want the game to play out, you might only trigger the message that it is unlocked once it is both downloaded and unlocked. If this would not work well for the game, you may need to stall it with an error, but assuming that the player has an active Internet connection, this should be a rare case. If the player is not online, there's not really much you can do.