HTTP Refresh Header (Meta Refresh)
There’s an HTTP
Refresh header that can be used to “refresh” a page every
When the header above is sent to a client (browsers) that supports it, the page will be refreshed every 5 seconds. The
Refresh header is actually non-standard (not part of the HTTP standard).
This header is part of a feature that was introduced by Netscape Navigator back in the 90s called “Meta refresh” that is still supported by some modern browsers. This method was introduced for redirections and refreshes in two ways:
- Using a
- Using an HTTP header.
Using a meta tag, this is what you’d need to do:
<meta http-equiv="refresh" content="5; url=https://example.com/">
The meta tag will load the
url specified (
example.com) after 5 seconds. If the
url is not specified, then the page will be refreshed or reloaded (same URL) after 5 seconds. Hence with the
url specified, redirection can be achieved, where as without it refresh will be achieved.
The HTTP header equivalent that a server can send is this:
Refresh: 5; url=http://www.example.com/
url is specified, then that’ll be loaded after 5 seconds. Otherwise as we saw above, without the
url the page will be refreshed after 5 seconds.
Meta refresh is an old way, discouraged and should not be used. Some server-side tools still use this technique to do a quick refresh or redirect the client.