JavaScript redirects cause unwanted search engine results

I have an HTML5 demo site ( http://html5beats.com/ ) that uses JavaScript to detect certain HTML5 features. I am redirecting to the "please change or update your browser" page if these functions are not available, since they are crucial for the site to work.

The problem is that some search engines (specifically Google) seem to be following the redirect. This leads to an unpleasant message "Your browser is not supported" as the main search result for my site.

Am I using JavaScript redirects incorrectly? Is there something I can do to tell Google and other search engines which page contains the main content of the site?

+3
source share
2 answers

First, you should use robots.txtto tell the search engines those pages that you do not want to list:

Secondly, you can also help Google (and other search engines) understand your site by providing a sitemap:

-, Google ( -) navigator.userAgent JavaScript :

navigator.userAgent. indexOf, URL- , :

function upgradeRedirect() {
 if (navigator.userAgent.indexOf("http://www.google.com/bot.html") != -1) return;
 document.location.href = 'upgrade.html';
}
+3

, Googlebot, , . , .., , html5 html5. , - : http://html5beats.com/. BTW - /.

+1

All Articles