🔄
   HOME

TheInfoList



OR:

Meta refresh is a method of instructing a
web browser A web browser is application software for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's screen. Browsers are used o ...
to automatically refresh the current web page or frame after a given time interval, using an
HTML The HyperText Markup Language or HTML is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaSc ...
meta element with the http-equiv parameter set to "refresh" and a content parameter giving the time interval in seconds. It is also possible to instruct the browser to fetch a different URL when the page is refreshed, by including the alternative URL in the content parameter. By setting the refresh time interval to zero (or a very low value), meta refresh can be used as a method of
URL redirection URL redirection, also called URL forwarding, is a World Wide Web technique for making a web page available under more than one URL address. When a web browser attempts to open a URL that has been redirected, a page with a different URL is opened ...
.


History

This feature was originally introduced by
Netscape Navigator Netscape Navigator was a web browser, and the original browser of the Netscape line, from versions 1 to 4.08, and 9.x. It was the flagship product of the Netscape Communications Corp and was the dominant web browser in terms of usage share in ...
1.1 (circa 1995), in a form of HTTP header and corresponding HTML meta HTTP-equivalent element, which allows document author to signal client to automatically reload the document or change to a specified URL after a specified timeout. It is the earliest
polling Poll, polled, or polling may refer to: Figurative head counts * Poll, a formal election ** Election verification exit poll, a survey taken to verify election counts ** Polling, voting to make decisions or determine opinions ** Polling places o ...
mechanism available for
the web The World Wide Web (WWW), commonly known as the Web, is an information system enabling documents and other web resources to be accessed over the Internet. Documents and downloadable media are made available to the network through web s ...
, allowing a user to see the latest update in a frequently-changing webpage, such as ones displaying stock price or
weather forecast Weather forecasting is the application of science and technology to predict the conditions of the atmosphere for a given location and time. People have attempted to predict the weather informally for millennia and formally since the 19th cent ...
.


Usability

Use of meta refresh is discouraged by the
World Wide Web Consortium The World Wide Web Consortium (W3C) is the main international standards organization for the World Wide Web. Founded in 1994 and led by Tim Berners-Lee, the consortium is made up of member organizations that maintain full-time staff working ...
(W3C), since unexpected refresh can disorient users.Core Techniques for Web Content Accessibility Guidelines 1.0
- W3C Note 6 November 2000
Meta refresh also impairs the web browser's "back" button in some browsers (including
Internet Explorer 6 Microsoft Internet Explorer 6 (IE6) is a graphical web browser developed by Microsoft for Windows operating systems. Released on August 24, 2001, it is the sixth, and by now discontinued, version of Internet Explorer and the successor to Internet ...
and before), although most modern browsers compensate for this (
Internet Explorer 7 Windows Internet Explorer 7 (IE7) (codenamed Rincon) is a web browser for Windows. It was released by Microsoft on October 18, 2006, as the seventh version of Internet Explorer and the successor to Internet Explorer 6. Internet Explorer 7 is pa ...
and higher,
Mozilla Mozilla (stylized as moz://a) is a free software community founded in 1998 by members of Netscape. The Mozilla community uses, develops, spreads and supports Mozilla products, thereby promoting exclusively free software and open standards, w ...
Firefox Mozilla Firefox, or simply Firefox, is a free and open-source web browser developed by the Mozilla Foundation and its subsidiary, the Mozilla Corporation. It uses the Gecko rendering engine to display web pages, which implements current ...
,
Opera Opera is a form of theatre in which music is a fundamental component and dramatic roles are taken by singers. Such a "work" (the literal translation of the Italian word "opera") is typically a collaboration between a composer and a libr ...
, Google Chrome). There are legitimate uses of meta-refresh, such as providing updates to
dynamic web page A server-side dynamic web page is a web page whose construction is controlled by an application server processing server-side scripts. In server-side scripting, parameters determine how the assembly of every new web page proceeds, and includi ...
s or implementing site controlled navigation of a website without
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the client side for webpage behavior, of ...
. Many large websites use it to refresh news or status updates, especially when dependencies on JavaScript and redirect headers are unwanted.


Examples

Place inside the <head> element to refresh page after 5 seconds: Redirect to https://example.com/ after 5 seconds: Redirect to https://example.com/ immediately:


Drawbacks

Meta refresh tags have some drawbacks: * If a page redirects too quickly (less than 2–3 seconds), using the "Back" button on the next page may cause some browsers to move back to the redirecting page, whereupon the redirect will occur again. This is bad for usability, as this may cause a reader to be "stuck" on the last website. * A reader may or may not want to be redirected to a different page, which can lead to user dissatisfaction or raise concerns about security.Meta Refresh Tag
An About.com article covering the use of the tag for page reloading or redirection


Alternatives

Meta refresh uses the http-equiv meta tag to emulate the Refresh
HTTP The Hypertext Transfer Protocol (HTTP) is an application layer protocol in the Internet protocol suite model for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide We ...
header, and as such can also be sent as a header by an HTTP web server. Although Refresh is not part of the
HTTP The Hypertext Transfer Protocol (HTTP) is an application layer protocol in the Internet protocol suite model for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide We ...
standard, it is supported by all common browsers. HTTP Header example of a redirect to https://example.com/ after 5 seconds: Refresh: 5; url=https://www.example.com/ Alternatives exist for both uses of meta refresh.


For redirection

An alternative is to send an HTTP redirection status code, such as
HTTP 301 The HTTP response status code 301 Moved Permanently is used for permanent redirecting, meaning that links or records returning this response should be updated. The new URL should be provided in the Location field, included with the response. The 3 ...
or 302. It is the preferred way to redirect a user agent to a different page. This can be achieved by a special rule in the Web server or by means of a simple script on the Web server.
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the client side for webpage behavior, of ...
is another alternative, but not recommended, because users might have disabled JavaScript in their browsers. The simplest way of JavaScript redirect using the onload property of the body tag:


For refresh

An alternative method is to provide an interaction device, such as a button, to let the user choose when to refresh the content. Another option is using a technique such as
Ajax Ajax may refer to: Greek mythology and tragedy * Ajax the Great, a Greek mythological hero, son of King Telamon and Periboea * Ajax the Lesser, a Greek mythological hero, son of Oileus, the king of Locris * ''Ajax'' (play), by the ancient Gree ...
to update (parts of) the Web site without the need for a complete page refresh, but this would also require that the user enable JavaScript in their browser. You can refresh a web page using JavaScript location.reload method. This code can be called automatically upon an event or simply when the user clicks on a link. If you want to refresh a web page using a mouse click, then you can use the following code : Refresh this Page


References

{{reflist


External links


W3C Web Content Accessibility Guidelines (1.0): Ensure user control of time-sensitive content changes

meta refresh deprecated by W3C

Use standard redirects: don't break the back button!


* ttps://www.fyi.my.id/2020/08/javascript-refresh-halaman.html JavaScript Page Refresh HTML Hypertext Transfer Protocol headers