Created
May 10, 2023 06:24
-
-
Save s-en-o/8bf14d39f72e99fb225c81fb6e839fb7 to your computer and use it in GitHub Desktop.
Checking server ping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const startTime = new Date(); | |
const img = new Image(); | |
img.onload = () => { const endtime = new Date(); const ping = endtime.getTime() - startTime.getTime(); alert(img.src + " loaded in " + ping + " ms"); }; | |
img.src = "https://somewebsite.com/some-image.png"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment