大网数据广告活动
Web 标准与前端开发

Refresh header

· 52CE 我爱测

The HTTP **`Refresh`** response header directs a web browser to either refresh or redirect the page when a specified amount of time has passed after the page was fully loaded. It is exactly equivalent to using `<meta http-equiv="refresh" content="...">` in HTML.

The HTTP Refresh response header directs a web browser to either refresh or redirect the page when a specified amount of time has passed after the page was fully loaded. It is exactly equivalent to using <meta http-equiv="refresh" content="..."> in HTML.

[!NOTE] Even though it's present in the HTTP response, the Refresh header is still handled by the HTML loading machinery and happens after HTTP or JavaScript redirects. See redirection order of precedence for more information.

[!NOTE] When a refresh redirects to a new page, the Referer header is included in the request for the new page (if permitted by the Referrer-Policy), and document.referrer is set to the referrer URL after navigating.

<table class="properties"> <tbody> <tr> <th scope="row">Header type</th> <td>Response header</td> </tr> </tbody> </table>

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>
    • : 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.

Examples

Refreshing a page after a specific time

This header will cause the browser to refresh the page 5 seconds after it is fully loaded (that is, after the Window/load_event event):

Refresh: 5

Redirecting after a specific time

This header will cause the browser to redirect to a URL 5 seconds after the page is fully loaded:

Refresh: 5; url=https://example.com/

[!NOTE] See the http-equiv="refresh" attribute in the HTML reference for important information about accessibility implications of automatic redirects.

Specifications

Browser compatibility

See also

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。