I'm creating a game using vanilla javascript (html/css/js), and I'm using GitHub Pages to host the website. The problem is that I'm not able to understand how I can edit a file (scores.json
) through javascript to save player scores. I can access the file and use the data, but I cannot modify it.
Edit: I practically haven't tested anything yet, because I haven't been able to find any useful information online, and I'm not very knowledgeable about reading and writing files on a website. The only thing I tested was this https://stackoverflow.com/a/21016088/13973113 which is not what I'm looking for, because it's the user saving the file locally and not the JavaScript to the repository. I'm also not familiarized with database which are probably a better solution for this.
Files:
index.html (homepage)
game/
├── assets/
│ └── scores.json
├── index.html (game page)
└── game.js