Meta refresh
Meta refresh is a method of instructing a web browser to automatically refresh the current web page or frame after a given time interval, using an HTML HistoryThis feature was originally introduced by Netscape Navigator 1.1 (circa 1995), in a form of HTTP header and corresponding HTML UsabilityUse of meta refresh is discouraged by the World Wide Web Consortium (W3C), since unexpected refresh can disorient users.[2] Meta refresh also impairs the web browser's "back" button in some browsers (including Internet Explorer 6 and before), although most modern browsers compensate for this (Internet Explorer 7 and higher, Mozilla Firefox, Opera, Google Chrome). There are legitimate uses of meta-refresh, such as providing updates to dynamic web pages or implementing site controlled navigation of a website without JavaScript. Many large websites use it to refresh news or status updates, especially when dependencies on JavaScript and redirect headers are unwanted. ExamplesPlace inside the <meta http-equiv="refresh" content="5">
Redirect to <meta http-equiv="refresh" content="5; url=https://example.com/">
Redirect to <meta http-equiv="refresh" content="0; url=https://example.com/">
DrawbacksMeta refresh tags have some drawbacks:
AlternativesMeta refresh uses the HTTP Header example of a redirect to Refresh: 5; url=https://www.example.com/
Alternatives exist for both uses of meta refresh. For redirectionAn alternative is to send an HTTP redirection status code, such as HTTP 301 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 is another alternative, but not recommended, because users might have disabled JavaScript in their browsers. The simplest way of JavaScript redirect using the <body onload="window.location = 'http://example.com/'">
<!-- Your content here -->
</body>
For refreshAn 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 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 : <a href="javascript:location.reload(true)">Refresh this Page</a>
References
External links |
Portal di Ensiklopedia Dunia