I am new to Javascript and web programming in general, so this can be a dumb mistake. However, I had problems finding information about this.
I am developing a game in Javascript where a player can walk and move from scene to scene by clicking and using his avatar in different buildings / objects. At the moment, I just have a place to change the page, calling this.gotoTimer = setTimeout(self.location = this.targetURL, 1000); if a collision is detected.
Links to pages are perfectly displayed in both browsers. The problem is that the user clicks the back button ... In Chrome, everything is reset; The player appears in the same area as in the code, and all the "linktargets" remain valid. This is the desired behavior.
In Firefox, when the back button is pressed and the page reloads, the player is in their last known position, and the link they visited will no longer link ... I can end up disabling them all by visiting them and click the button "Back".
From what I was able to research, there seems to be a problem with how Firefox relates to the cache, and the workaround I could find involves adding a random number or time to Javascript files. It seems rude to me. I can go out too.
Therefore, I am interested in two things:
- Is this the exact premise of the problem or is there another problem?
- If so, then what is the best way to add these numbers. The whole concept seems to me very hoarse ...
source share