JavaScript location.reload()

location.reload() reloads the current URL. The simplest form is:

location.reload();

Reload using a button Top ↑

The original demo button is preserved, with the event handler moved out of inline HTML.

const button = document.getElementById('refreshButton');
button.addEventListener('click', () => location.reload());

You can move to the previous page using a Back button

Refreshing a child window Top ↑

The original example refreshed a child window referenced by tm. Keep the reference and check it before accessing it.

if (tm && !tm.closed) {
  tm.location.reload();
  tm.focus();
}

You can also read how to refresh the parent window from a child window.

JavaScript location Getting hostname Full URL




Subscribe to our YouTube Channel here



plus2net.com










We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
©2000-2026   plus2net.com   All rights reserved worldwide Privacy Policy Disclaimer