Redirections test

What does it do?

Test whether the website uses client-side redirections, an unnecessary trick which prevents visitors from using the Back button (every time they try, it reloads the current page), impairs SEO and Accessibility.

Example results

Example of redirections test results

Why is it important?

These type of redirections are completely unnecessary and frustrate users. They also often prevent users without JavaScript enabled from accessing pages, and search engines such as Google. An alternative form of redirection (server-side redirections) can be used without any of these side effects.

How is it measured?

Sitebeam checks each page in turn for the use of certain Javascript or Meta tags which perform these redirections. The score is penalized heavily for client-side redirection in the site, proportional to the size of the website. Redirections on the homepage incur a special additional penalty as they can prohibit access to the entire website for some users and search engines.

Technical explanation

Sitebeam checks for use of the Meta Refresh tag, or the use of Javascript fragments extended from one of the following:

location.href = ' ... '
location.replace ( ... )
window.location = ' ... '
window.location.replace ( ... )

How to improve this score

Replace all client-side redirections with server-side redirections. This is a technical process that generally requires a web programmer. In our experience, the biggest problem detected by this test are websites which redirect from their domain name (e.g. www.example.com) to another page (www.example.com/content/home) through client-side means. If accomplished through JavaScript, this is possibly the single worst thing that can be done to a website – it makes it inaccessible, totally cripples its search engine placement and exists only through sheer laziness of the developer. A server side redirect equivalent would be between 2-4 lines of code in almost any language (ASP / PHP / JSP). Where more complex conditions are evaluated (e.g. determining screen size via JavaScript), there should always be a link-based alternative for users without JavaScript and for search engines.

Shortcomings

Sitebeam cannot possibly simulate the actual execution of the JavaScript that would go on every webpage (this is fundamentally impossible). Accordingly, it is vulnerable to some false positives and negatives, such as:

  • Client is redirected via JavaScript following a user requested condition e.g. clicking in a drop-down menu. Generally such JavaScript is not recommended, but it can sometimes fire as a false positive.
  • Redirection is obfuscated by exceptional methods JavaScript can be concealed through layers of encrypted eval statements, and other trickery. Such methods are impossible to detect.

How to use this test effectively

Ensure that client side redirections are never used on your website, replace them with server-side redirections wherever possible.

Further reading

Was this article helpful? Contact our support team if you have a question.