Back to Blog

How to Automatically Reload a Page When It Shows an Error

PB

Patrick Bushe

July 25, 2025 ยท 5 min read

Pages that show an error now and then, such as a dashboard that hits a "502 Bad Gateway" overnight or a status screen that loses its connection, can be brought back automatically. The method depends on the kind of error.

Connection errors: Chrome often handles it

When a page fails because your internet dropped ("No internet", ERR_INTERNET_DISCONNECTED), Chrome usually reloads it by itself once the connection comes back, as long as the tab is open. If that doesn't happen, the methods below cover it.

Reload on a timer

The simplest fix is reloading the page every few minutes, whether or not there's an error. A page that failed comes back on the next reload.

AutoBrowser does this: put the page in a bookmark folder on its own, choose that folder and set how long to wait (1 second to 5 minutes). AutoBrowser loads the page again each time the timer runs out, which also clears a page stuck on an error. With several pages in the folder, it cycles through them in one tab, which suits wall screens and monitoring setups. It doesn't check for errors itself; it simply reloads on schedule.

Don't use timed reloads on pages where you type, since a reload throws away unsaved input.

Reload only when the page shows an error

For server errors shown by the site (502, 503, 504 or a "something went wrong" page), a small userscript can watch for the error and reload. With a userscript manager such as Tampermonkey installed, add a script for the site like this:

if (/502|503|504|Bad Gateway|Service Unavailable/i.test(document.title + document.body.innerText.slice(0, 500))) setTimeout(() => location.reload(), 30000);

It waits 30 seconds, so a struggling server isn't hammered, then reloads. Adjust the words to match the error your site shows. Extensions and userscripts can't run on Chrome's own error pages (the dinosaur page and "This site can't be reached"), so for those, use the timer method.

"This page needs to be reloaded" and crashes

If a page keeps crashing ("Aw, Snap!", out of memory, or a message that the page needs to be reloaded), reloading only hides the problem:

  • Close tabs you aren't using, or check Shift + Esc (Chrome's Task Manager on Windows) for a tab or extension using a lot of memory.
  • Turn off extensions one at a time to find a conflict. See how to disable extensions without uninstalling them.
  • Update Chrome, and clear the site's data from the icon left of the address.
  • If a tab reloads when you return to it, Memory Saver discarded it. Add the site under Settings โ†’ Performance โ†’ Always keep these sites active.

For kiosks and unattended screens

Combine a timed reload with Chrome's kiosk mode (chrome.exe --kiosk https://example.com), automatic sign-in on the site where possible, and a computer set never to sleep. For keeping a logged-in session alive, see how to keep a web session alive.

More Tools by Patrick Bushe

Free Chrome extensions to boost your productivity and privacy