1

What is the equivalent of these two meta tags:

<meta http-equiv="refresh" content="0; URL=http://www.example.com/">

<meta http-equiv="refresh" content="35; URL=http://www.example.com/">

In JavaScript?

1 Answers1

1

If you just need a refresh you can use window.location.reload().

If you need it to fire after 35 seconds use setTimeout(function() { window.location.reload(); }, 35000);

To redirect to another page you can use either window.location.replace('http://www.example.com') to make sure the browser Back button skips the previous page, or window.location = 'http://www.example.com' to preserve the browser history.

DunningKrugerEffect
  • 603
  • 1
  • 5
  • 18