Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
URL redirection
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Refresh Meta tag and HTTP refresh header === [[Netscape]] introduced the [[meta refresh]] feature which refreshes a page after a certain amount of time. This can specify a new URL to replace one page with another. This is supported by most web browsers.<ref name="iFTFs" /><ref name="BEKGZ" /> A timeout of zero seconds effects an immediate redirect. This is treated like a 301 permanent redirect by Google, allowing transfer of PageRank to the target page.<ref name="DOOOW" /> This is an example of a simple HTML document that uses this technique: <syntaxhighlight lang="html"> <html> <head> <meta http-equiv="Refresh" content="0; url=https://www.example.com/" /> </head> <body> <p>Please follow <a href="https://www.example.com/">this link</a>.</p> </body> </html> </syntaxhighlight> This technique can be used by [[Web designer|web authors]] because the meta tag is contained inside the document itself. The meta tag must be placed in the "head" section of the HTML file. The number "0" in this example may be replaced by another number to achieve a delay of that many seconds. The anchor in the "body" section is for users whose browsers do not support this feature. The same effect can be achieved with an HTTP <code>refresh</code> header: <syntaxhighlight lang="http"> HTTP/1.1 200 OK Refresh: 0; url=https://www.example.com/ Content-Type: text/html Content-Length: 78 Please follow <a href="https://www.example.com/">this link</a>. </syntaxhighlight> This response is easier to generate by CGI programs because one does not need to change the default status code. Here is a simple CGI program that effects this redirect: <syntaxhighlight lang="perl"> # !/usr/bin/env perl print "Refresh: 0; url=https://www.example.com/\r\n"; print "Content-Type: text/html\r\n"; print "\r\n"; print "Please follow <a href=\"https://www.example.com/\">this link</a>!" </syntaxhighlight> Note: Usually, the HTTP server adds the status line and the Content-Length header automatically. The [[World Wide Web Consortium|W3C]] discourage the use of meta refresh, since it does not communicate any information about either the original or new resource, to the browser (or [[search engine]]). The W3C's Web Content Accessibility Guidelines (7.4)<ref name="DO1Os" /> discourage the creation of auto-refreshing pages, since most web browsers do not allow the user to disable or control the refresh rate. Some articles that they have written on the issue include [https://www.w3.org/TR/WAI-WEBCONTENT/#gl-movement W3C Web Content Accessibility Guidelines (1.0): Ensure user control of time-sensitive content changes], Use standard redirects: don't break the back button!<ref name="sEvbk" /> and Core Techniques for Web Content Accessibility Guidelines 1.0 section 7.<ref name="V6sLN" />
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)