HTTP Headers
Refresh
The HTTP Refresh
response header instructs a web browser to either refresh or redirect the page after a specified period once the page has fully loaded.
It functions exactly like using <meta http-equiv="refresh" content="...">
in HTML.
Header type | Response header |
---|---|
Forbidden request header | No |
Syntax
Syntax
Refresh: <time>
Refresh: <time>, url=<url>
Refresh: <time>; url=<url>
- <time>
A non-negative number of seconds after which to refresh the page. Fractional parts are recognized but ignored; you should only specify integers.
- <url> Optional
If present, the browser will redirect to the specified URL instead of refreshing with the current URL. This URL can be quoted or unquoted. The
url=
prefix is case-insensitive and optional.
Directives
Examples
This section provides practical examples on how to refresh a webpage after a specified period and redirect to a different URL seamlessly.
To refresh a webpage 5 seconds after it fully loads, you can use the following header. This instructs the browser to reload the page after a set time interval, enhancing user experience in scenarios like showcasing rotating banners or auto-updating content:
Refresh: 5
Similarly, you can redirect visitors to another page after a certain duration. This is useful for automatic navigation or login redirects:
Refresh: 5; url=https://example.com/
How to Modify Header using Requestly
- Install and open the Requestly Chrome extension. You can find it on the Chrome Web Store.
- Create a new rule: Click on “Create Rule” and choose “Modify Headers” from the list of available rule types.
- Add a new header modification:
- Under “Action”, select “Add” or “Override”.
- In the “Header Name” field, enter Refresh.
- In the “Header Value” field, enter your preferred refresh value (e.g., 5; url=https://example.com).
- Set the URL condition: Specify the URL or pattern where this header change should apply (e.g., https://your-website.com/*).
- Save the rule.
Once set up, Requestly will inject the Refresh header into all matching requests, allowing you to control page refresh timing or redirects for testing purposes.
Modifying the Refresh header can help you simulate automatic page reloads or timed redirects to see how your site or app behaves, making it easier to troubleshoot or optimize user experience.
Table of Contents
- No headings found.