I had that problem too, I couldn't figure out why my game wouldn't open in Safari, but I had to upload the file onto a website (I used Neocities), and then it worked. When I inspected the code in Safari when it wasn't working, it said it was because it wasn't secure, so I think it's just one of Safari's idiosyncrasies, you have to attach it to a domain name, it won't just open from your computer's files.