What's the best way to reload a web page using JavaScript? or How can I reload a web page with JavaSc

18 Replies, 852 Views

Hey! So `location.reload()` is the classic way to reload web page javascript, but yeah, it can be a bit aggressive. If you wanna force a fresh server fetch, use `location.reload(true)`.

But if you just wanna refresh without hitting the server, `window.location.href = window.location.href` works too—it’s just a bit clunky.

For debugging, check if your code’s running in a weird scope or if there’s an error blocking it. DevTools (F12) is your friend here!

Messages In This Thread



Users browsing this thread: 1 Guest(s)