Are Javascript Redirects SEO Friendly?

Posted by

So, you want to implement JavaScript redirects, however you’re not sure how they work?

Yes, they are more difficult to implement than standard redirects.

Preferably, you need to utilize 301s, 302s, or 307-based redirects for execution. This is the typical finest practice.

But … what if you don’t have that level of access? What if you have an issue with producing basic redirects in such a method that would be advantageous to the site as a whole?

This is where using JavaScript redirects can be found in.

They are not a best practice that you need to be using solely, however.

But there are some scenarios where you just can not avoid utilizing a JavaScript redirect.

The following is a fundamental primer on JavaScript reroutes, when to utilize them, how to use them, and finest practices you must use when using these types of redirects for SEO.

What Are JavaScript Redirects?

JavaScript redirects, essentially, are one of several techniques of informing users and web crawlers that a page is available in another place.

They are often used to notify users about modifications in the URL structure, however they can be used for just about anything.

A lot of contemporary websites utilize these types of redirects to redirect to HTTPS versions of websites.

Then, whenever someone checks out the original URL, the web browser loads the JavaScript file and executes whatever code is within it. If the script includes instructions to open a different URL, it does this immediately.

Doing redirects in this manner works in several methods.

For example, you can change URLs without manually updating each and every single URL on your website. In addition, JavaScript redirects can make it easier for search engines to find your own material.

A Quick Summary Of Redirect Types

There are several fundamental redirect types, all of which are helpful depending on your scenario.

Server-side Redirects

Ideally, a lot of redirects will be server-side redirects.

These types of redirects originate on the server, and this is where the server chooses which location to reroute the user or online search engine to when a page loads. And the server does this by returning a 3xx HTTP status code.

For SEO reasons, you will likely utilize server-side reroutes the majority of the time. Client-side redirects have some downsides, and they are typically appropriate for more specific scenarios.

Client-side Redirects

Client-side redirects are those where the browser is what decides the location of where to send out the user to. You need to not have to utilize these unless you’re in a circumstance where you don’t have any other choice to do so.

Meta Refresh Redirects

The meta revitalize redirect gets a bad rap and has a horrible reputation within the SEO neighborhood.

And for good reason: they are not supported by all browsers, and they can be confusing for the user. Rather, Google recommends using a server-side 301 redirect instead of any meta refresh reroutes.

JavaScript Redirects

JavaScript redirects, nevertheless, utilize the JavaScript language to send directions to the internet browser to reroute users to another URL. There is a dominating belief that JavaScript redirects cause problems for SEO.

Although Google does have great JavaScript rendering capabilities nowadays, JavaScript can still provide issues. This is true for other types of platforms likewise, such as Spotify and other ecommerce platforms.

If, however, you’re in a situation where you can only utilize a JavaScript redirect as your only choice, then you can only use JavaScript.

Also, Google’s Gary Illyes has mentioned as just recently as 2020 that JavaScript Reroutes “are most likely not a great concept.”

Js redirects are most likely not a good concept though.

— Gary 鯨理 / 경리 Illyes (@methode) July 8, 2020

Finest Practices For SEO-Friendly JavaScript Redirects

Regardless of whether you are utilizing conventional redirects or JavaScript redirects, there are numerous best practices you must follow in order to not mess things up for SEO.

These finest practices consist of preventing redirect chains and redirect loops.

What’s the difference?

Prevent Redirect Chains

A redirect chain is a long chain of redirect hops, describing any circumstance where you have more than 1 redirect in a chain.

Example of a redirect chain:

Redirect 1 > redirect 2 > redirect 3 > redirect 4 > redirect 5

Why are these bad? Google can just process up to 3 redirects, although they have been understood to process more.

Google’s John Mueller suggests less than 5 hops per redirect.

“It doesn’t matter. The only thing I ‘d keep an eye out for is that you have less than 5 hops for URLs that are frequently crawled. With multiple hops, the primary impact is that it’s a bit slower for users. Online search engine just follow the redirect chain (for Google: approximately 5 hops in the chain per crawl effort).”

Preferably, webmasters will want to aim for no greater than one hop.

What takes place when you include another hop? It slows down the user experience. And more than five present substantial confusion when it comes to Googlebot having the ability to understand your website at all.

Repairing redirect chains can take a lot of work, depending upon their complexity and how you set them up.

However, the primary concept driving the repair of redirect chains is: Just ensure that you complete 2 steps.

First, eliminate the additional hops in the redirect so that it’s under 5 hops.

Second, execute a redirect that reroutes the previous URLs

Avoid Redirect Loops

Redirect loops, by comparison, are basically a boundless loop of redirects. These loops happen when you reroute a URL to itself. Or, you unintentionally redirect a URL within a redirect chain to a URL that takes place earlier in the chain.

Example of a redirect loop: Redirect 1 > redirect 2 > redirect 3 > redirect 2

This is why oversight of site redirects and URLs are so important: You don’t desire a situation where you carry out a redirect just to discover 3 months down the line that the redirect you produced months ago was the reason for problems because it produced a redirect loop.

There are a number of reasons these loops are disastrous:

Concerning users, redirect loops remove all access to a specific resource situated on a URL and will wind up triggering the browser to show a “this page has a lot of redirects” error.

For search engines, reroute loops can be a significant waste of your crawl spending plan. They also develop confusion for bots.

This develops what’s referred to as a spider trap, and the crawler can not get out of the trap easily unless it’s by hand pointed somewhere else.

Repairing redirect loops is pretty simple: All you have to do is remove the redirect causing the chain’s loop and replace it with a 200 OK operating URL.

Wish To Utilize JavaScript Redirects For SEO? Not So Fast …

Beware about developing JavaScript reroutes because they may not be the very best option for redirects, depending on what you have access to.

They must not be your go-to solution when you have access to other redirects since these other kinds of redirects are preferred.

But, if they are the only option, you may not be shooting yourself in the foot.

More resources:

Featured Image: RoseRodionova/Best SMM Panel