Meta refresh â ⬠<â ⬠is a method of instructing the web browser to automatically refresh the current web page or frame after a certain time interval, using the HTML element meta âââ ⬠< â¬
with
http-after the
parameter set to " refresh
" and the content
parameter gives the time interval in seconds. You can also instruct the browser to retrieve a different URL when the page is refreshed, by entering an alternate URL within the content
parameter. By setting the refresh time interval to zero (or a very low value), meta refresh can be used as a URL redirection method.
Video Meta refresh
Usability
The use of meta refresh is not recommended by the World Wide Web Consortium (W3C), because unexpected refreshes can confuse users. Meta refreshes also ruin the "back" buttons of web browsers in some browsers (including Internet Explorer 6 and earlier), though most modern browsers compensate for this (Internet Explorer 7 and higher, Mozilla Firefox, Opera, Google Chrome).
There is a legitimate use of meta-refresh, such as providing updates to dynamic web pages or implementing controlled site navigation from a website without JavaScript. Many large websites use it to refresh news or status updates, especially when dependence on JavaScript and redirect headers is not desirable.
Maps Meta refresh
Example
Place within & lt; head & gt;
to refresh the page after 5 seconds:
Switch to http://example.com/
after 5 seconds:
Switch to http://example.com/
immediately:
Weakness
The meta refresh tag has several flaws:
- If the page is redirected too quickly (less than 2-3 seconds), using the "Back" button on the next page may cause some browsers to return to the redirect page, where redirects will happen again. This is bad for usability, as this can cause the reader to be "stuck" on the last website.
- The reader may or may not want to be redirected to another page, which may cause user dissatisfaction or increase security concerns.
Alternative
Meta refreshes use the http-equiv
meta tag to mimic the Refresh
HTTP header, and thus can also be sent as headers by the HTTP web server, even Refresh
not part of the HTTP standard.
There are alternatives to both meta refresh usage.
For redirect
The alternative is to send an HTTP redirection status code, such as HTTP 301 or 302. This is the preferred way to redirect a user's agent to a different page. This can be accomplished with custom rules on a Web server or via simple scripts on a Web server.
JavaScript is another alternative, but not recommended, because users may have disabled JavaScript in their browsers.
The simplest JavaScript redirects use the onload
property of the body
tag:
To refresh
An alternative method is to provide interaction devices, such as buttons, to allow users to choose time to refresh content. Another option is to use techniques such as Ajax to update (sections) of websites without requiring full page refreshes, but this also requires users to enable JavaScript in their browsers.
To redirect noscript browsers
Using the following techniques, browsers that do not understand JavaScript can be redirected to alternatively designed pages without requiring support for JavaScript.
For example, if the current URL is news.php
, the browser will redirect to news-nojs.php
.
References
External links
- W3C Web Content Accessibility Guidelines (1.0): Ensure user control over time-sensitive content changes Refresh
-
meta âââ ⬠<â â¬
- Use standard redirects: do not break the back button!
Source of the article : Wikipedia