Why does Chrome not redirect using meta refresh Why does Chrome not redirect using meta refresh google-chrome google-chrome

Why does Chrome not redirect using meta refresh


If you check the w3c wiki you can find the following quote:

Exactly one of the name, http-equiv, and charset attributes must be specified.

It mean's it is not valid html that both - name and http-equiv attributes are set.

Read this W3C's HTML and XHTML Techniques test on meta refresh:

Find all meta elements in the document. For each meta element, check if it contains the attribute http-equiv with value "refresh" (case-insensitive) and the content attribute with a number greater than 0 followed by ;'URL=anyURL' (where anyURL stands for the URI that should replace the current page).

The behavouir of the other browsers is not wrong, but chrome is more strict.

More details about the correct behavouir - and the valid reference - are available at http://www.w3.org/TR/html5/document-metadata.html#attr-meta-http-equiv-refresh


As far as browser support:

The support for <meta> refresh is there even in IE6

The syntax to be used is:

Place inside <head> to refresh page after 5 seconds:

<meta http-equiv="refresh" content="5">

Redirect to http://example.com/ after 5 seconds:

<meta http-equiv="refresh" content="5; url=http://example.com/">

Redirect to http://example.com/ immediately:

<meta http-equiv="refresh" content="0; url=http://example.com/">

If you plan to support javascript disablers (Which I don't think you should do :)

Do this:<noscript><meta http-equiv="refresh" content="0; url=url here"></noscript>

It is not a part of HTTP standard.

However, there are alternatives:

For refreshing the page after 5 seconds, do the below:

<body onload="javascript:setTimeout(function(){ location.reload(); },5000);">

If you want to redirect after 5 seconds, then do the below:

<body onload="javascript:setTimeout(function(){ window.location = 'http://example.com';},5000);">

If you want to redirect immediately:

<body onload="javascript:window.location='http://example.com'">

But there isn't any alternative for javascript disablers (yippee!!)

Conclusion:

So, my suggestion, would be to use my javascript alternatives, because they are not going to be replaced.

But <meta> refresh tag may be discontinued in the coming years.

More reading : http://en.wikipedia.org/wiki/Meta_refresh


For the <META tags, Microsoft has published specific guidelines:

Page and site guidelines for SEO

Specifically, for the <meta http-equiv="refresh"> element, Microsoft states the following:

A page redirect should provide both a message with the new page location and sufficient time for users to read the message. A page redirect with a time-out period of less than five seconds may result in a lower search-engine ranking.

To redirect a page, consider using an HTTP redirect instead. An HTTP redirect is more likely to transfer the authority of the old page to the new page.

Personally, instead of a <meta refresh tag, I would recommend you use a 301 Redirect. In PHP you could do, for example, the following:

<?phpheader("HTTP/1.1 301 Moved Permanently");header("Location: http://www.yourdomain.com/newpage");?>

This method is better than the <meta refresh because usually a 301 redirect includes the address to which the resource has been moved. Web browsers will typically follow 301 redirects to the new location automatically, without the need for user action.

According to some definitions of 301 Redirect, it would even preserve old positions:

A 301 redirect should be used whenever a website is moved to a new domain name (URL) so that search engines will quickly change their indeces and, in theory, preserve the search engine rankings that the site had at the previous domain.

All this is in line with the fact that many shady websites use <meta refresh to open unwanted websites (spam/ advertisements etc.). Hence I would conclude that the refresh meta tag should not be used.

For the other meta tags, please read the following: 18 meta tags every webpage should have.

Keep in mind that not all meta tags are of crucial importance; for example, Google says it does not use the keywords meta tag in web ranking.

But remember: it is Better to have, and not need, than to need, and not have.

Just don't use the <META refresh ;)