this post was submitted on 15 Jul 2023
3 points (100.0% liked)

Web Development

0 readers
1 users here now

Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient

founded 1 year ago
MODERATORS
 

I'll try to make this as short as I can, but with enough info to make sense. Be warned, I am not a programmer or developer by any means. I'm just a hobbyist who spends a lot of time trying to learn on my own.

I'm looking to save "https://scorecount.com/tennis/" locally on a PC so that it can be used offline. I've done the normal "right click, save as" routine in both Firefox and Chrome, which saves the main page (I save it with the name "tennis") as well as a similarly named folder that contains the js, css, and image files. (so, in my case... "tennis.html" and a folder called "tennis_files")

When I try open the tennis.html file, my browser eventually gets to a "we're having trouble finding that site" message. The URL it's trying to reach in the URL bar is "https://driveLetter/path/on/local/drive/tennis.html", instead of the more expected "file:///driveLetter/path/on/local/drive/tennis.html".

I believe I've narrowed this down to something in the tennis.js file (which gets renamed to "tennis.js.download" when I save the page locally). If I remove this file, the page loads, but of course it doesn't actually work. I think something in there is redirecting the URL, but now that the file is saved locally the path it's creating and trying to reach doesn't work.

I've tried going through the js, deciphering all of the array references as best I can, but I'm not able to figure out where this is happening. I'm hoping someone can throw me a lifeline. Thanks in advance!

Edit: Update in comment

you are viewing a single comment's thread
view the rest of the comments
[–] captsneeze@lemmy.one 1 points 1 year ago* (last edited 1 year ago)

Update: I’ve been banging my head against this for another day and have made a bit of progress. I think part of my original problem has to do with CORS issues. I’ve gotten around this by running a local server and navigating to the local html file via http (http://local host:8080/tennis.html) instead of file (file:///drive/path/tennis.html).

After this, I was running into an error with https. I believed something in the js was forcing redirection to https protocol. I “fixed” this by changing the value of _0x15ea[1] from “https:” to “http:” in the tennis.js file.

Now, I am able to get the locally saved page to load in a browser, but none of the actions that normally update the score on the scoreboard are working. For example, when loaded from the original website (scorching.com), clicking on the game score (white boxes on right) will increase that player’s score by 1. Likewise, the “z” and “x” keyboard keys will increase the player 1 and 2 scores, respectively. (In case anyone isn’t familiar with tennis scoring, the game score numbers advance through 15, 30, 40…, so don’t be surprised that they aren’t going 1, 2, 3…

The other things on the page all seem to be working. Just the scoring isn’t working,~~or the inputs to activate scoring changes aren’t being recognized.~~ (In the browser’s console I can see “scores 1” or “scores 2” being logged, which is the first instruction in the “scores” function, so I know the inputs are being recognized.) Appreciate any thoughts that might help me.