6.1 C
New York
Tuesday, December 5, 2023

What SEOs Actually Must Know About JavaScript search engine optimisation

Do you know that whereas the Ahrefs Weblog is powered by WordPress, a lot of the remainder of the positioning is powered by JavaScript like React?

The truth of the present internet is that JavaScript is in all places. Most web sites use some form of JavaScript so as to add interactivity and enhance person expertise. 

But a lot of the JavaScript used on so many web sites gained’t impression search engine optimisation in any respect. If in case you have a standard WordPress set up with out plenty of customization, then seemingly not one of the points will apply to you.

The place you’ll run into points is when JavaScript is used to construct a whole web page, add or take away parts, or change what was already on the web page. Some websites use it for menus, pulling in merchandise or costs, grabbing content material from a number of sources or, in some circumstances, for every thing on the positioning. If this appears like your website, preserve studying.

We’re seeing complete methods and apps constructed with JavaScript frameworks and even some conventional CMSes with a JavaScript aptitude the place they’re headless or decoupled. The CMS is used because the backend supply of knowledge, however the frontend presentation is dealt with by JavaScript.

I’m not saying that SEOs have to exit and discover ways to program JavaScript. I really don’t advocate it as a result of it’s not going that you’ll ever contact the code. What SEOs have to know is how Google handles JavaScript and learn how to troubleshoot points. 

JavaScript search engine optimisation is part of technical search engine optimisation (search engine marketing) that makes JavaScript-heavy web sites straightforward to crawl and index, in addition to search-friendly. The purpose is to have these web sites be discovered and rank larger in engines like google.

JavaScript is just not unhealthy for search engine optimisation, and it’s not evil. It’s simply totally different from what many SEOs are used to, and there’s a little bit of a studying curve. 

Quite a lot of the processes are just like issues SEOs are already used to seeing, however there could also be slight variations. You’re nonetheless going to be principally HTML code, not really JavaScript.

All the traditional on-page search engine optimisation greatest practices nonetheless apply. See our information on on-page search engine optimisation.

You’ll even discover acquainted plugin-type choices to deal with plenty of the fundamental search engine optimisation parts, if it’s not already constructed into the framework you’re utilizing. For JavaScript frameworks, these are referred to as modules, and also you’ll discover a number of bundle choices to put in them.

There are variations for most of the fashionable frameworks like React, Vue, Angular, and Svelte that you could find by looking for the framework + module title like “React Helmet.” Meta tags, Helmet, and Head are all fashionable modules with comparable performance and permit for most of the fashionable tags wanted for search engine optimisation to be set.

In some methods, JavaScript is healthier than conventional HTML, equivalent to ease of constructing and efficiency. In some methods, JavaScript is worse, equivalent to it might’t be parsed progressively (like HTML and CSS might be), and it may be heavy on web page load and efficiency. Usually, chances are you’ll be buying and selling efficiency for performance.

JavaScript isn’t excellent, and it isn’t at all times the appropriate software for the job. Builders do overuse it for issues the place there’s in all probability a greater answer. However typically, you need to work with what you’re given.

JavaScript search engine optimisation points and greatest practices

These are most of the widespread search engine optimisation points chances are you’ll run into when working with JavaScript websites.

Have distinctive title tags and meta descriptions

You’re nonetheless going to wish to have distinctive title tags and meta descriptions throughout your pages. As a result of plenty of the JavaScript frameworks are templatized, you possibly can simply find yourself in a scenario the place the identical title or meta description is used for all pages or a gaggle of pages.

Verify the Duplicates report in Ahrefs’ Website Audit and click on into any of the groupings to see extra information concerning the points we discovered.

Checking for duplicate title tags and meta descriptions

You need to use one of many search engine optimisation modules like Helmet to set customized tags for every web page.

JavaScript may also be used to overwrite default values you will have set. Google will course of this and use the overwritten title or description. For customers, nevertheless, titles might be problematic, as one title might seem within the browser and so they’ll discover a flash when it will get overwritten.

For those who see the title flashing, you should utilize Ahrefs’ search engine optimisation Toolbar to see each the uncooked HTML and rendered variations.

Raw and rendered titles and meta descriptions in Ahrefs' SEO Toolbar

Google might not use your titles or meta descriptions anyway. As I discussed, the titles are value cleansing up for customers. Fixing this for meta descriptions gained’t actually make a distinction, although.

Once we studied Google’s rewriting, we discovered that Google overwrites titles 33.4% of the time and meta descriptions 62.78% of the time. In Website Audit, we’ll even present you which ones of your title tags Google has modified.

"Page and SERP titles do not match" issue in Ahrefs' Site Audit

Canonical tag points

For years, Google stated it didn’t respect canonical tags inserted with JavaScript. It lastly added an exception to the documentation for circumstances the place there wasn’t already a tag. I induced that change. I ran checks to point out this labored when Google was telling everybody it didn’t.

If there was already a canonical tag current and also you add one other one or overwrite the prevailing one with JavaScript, then you definately’re giving them two canonical tags. On this case, Google has to determine which one to make use of or ignore the canonical tags in favor of different canonicalization alerts.

Commonplace search engine optimisation recommendation of “each web page ought to have a self-referencing canonical tag” will get many SEOs in hassle. A dev takes that requirement, and so they make pages with and and not using a trailing slash self-canonical.

instance.com/web page with a canonical of instance.com/web page and instance.com/web page/ with a canonical of instance.com/web page/. Oops, that’s improper! You in all probability wish to redirect a kind of variations to the different.

The identical factor can occur with parameterized variations that you could be wish to mix, however every is self-referencing.

Google makes use of essentially the most restrictive meta robots tag

With meta robots tags, Google is at all times going to take essentially the most restrictive possibility it sees—regardless of the situation. 

If in case you have an index tag within the uncooked HTML and noindex tag within the rendered HTML, Google will deal with it as noindex. If in case you have a noindex tag within the uncooked HTML however you overwrite it with an index tag utilizing JavaScript, it’s nonetheless going to deal with that web page as noindex.

It really works the identical for nofollow tags. Google goes to take essentially the most restrictive possibility. 

Set alt attributes on photographs

Lacking alt attributes are an accessibility subject, which can flip right into a authorized subject. Most huge corporations have been sued for ADA compliance points on their web sites, and a few get sued a number of instances a 12 months. I’d repair this for the principle content material photographs, however not for issues like placeholder or ornamental photographs the place you possibly can go away the alt attributes clean.

For internet search, the textual content in alt attributes counts as textual content on the web page, however that’s actually the one position it performs. Its significance is usually overstated for search engine optimisation, in my view. Nonetheless, it does assist with picture search and picture rankings.

A lot of JavaScript builders go away alt attributes clean, so double-check that yours are there. Have a look at the Photos report in Website Audit to search out these.

Checking for missing alt attributes on JavaScript-powered sites

Permit crawling of JavaScript recordsdata

Don’t block entry to assets if they’re wanted to construct a part of the web page or add to the content material. Google must entry and obtain assets in order that it might render the pages correctly. In your robots.txt, the best solution to enable the wanted assets to be crawled is to add:

Person-Agent: Googlebot
Permit: .js
Permit: .css

Additionally verify the robots.txt recordsdata for any subdomains or extra domains chances are you’ll be making requests from, equivalent to these to your API calls.

If in case you have blocked assets with robots.txt, you possibly can verify if it impacts the web page content material utilizing the block choices within the “Community” tab in Chrome Dev Instruments. Choose the file and block it, then reload the web page to see if any adjustments had been made.

"Block request URL" option in dropdown

Verify if Google sees your content material

Many pages with JavaScript performance might not be displaying all the content material to Google by default. For those who speak to your builders, they might confer with this as being not Doc Object Mannequin (DOM) loaded. This implies the content material wasn’t loaded by default and is perhaps loaded later with an motion like a click on.

A fast verify you are able to do is to easily seek for a snippet of your content material in Google inside citation marks. Seek for “some phrase out of your content material” and see if the web page is returned within the search outcomes. Whether it is, then your content material was seemingly seen.


Content material that’s hidden by default might not be proven inside your snippet on the SERPs. It’s particularly vital to verify your cell model, as that is usually stripped down for person expertise.

You can even right-click and use the “Examine” possibility. Seek for the textual content throughout the “Components” tab.

Searching for text in the DOM when working with JavaScript websites

The most effective verify goes to be looking throughout the content material of certainly one of Google’s testing instruments just like the URL Inspection software in Google Search Console. I’ll speak extra about this later.

I’d positively verify something behind an accordion or a dropdown. Usually, these parts make requests that load content material into the web page when they’re clicked on. Google doesn’t click on, so it doesn’t see the content material.

For those who use the examine technique to go looking content material, make certain to repeat the content material after which reload the web page or open it in an incognito window earlier than looking. 

For those who’ve clicked the ingredient and the content material loaded in when that motion was taken, you’ll discover the content material. You might not see the identical outcome with a recent load of the web page.

Duplicate content material points

With JavaScript, there could also be a number of URLs for a similar content material, which results in duplicate content material points. This can be attributable to capitalization, trailing slashes, IDs, parameters with IDs, and many others. So all of those might exist:


For those who solely need one model listed, it’s best to set a self-referencing canonical and both canonical tags from different variations that reference the principle model or ideally redirect the opposite variations to the principle model.

Verify the Duplicates report in Website Audit. We break down which duplicate clusters have canonical tags set and which have points.

Duplicate content clusters within Ahrefs' Site Audit

A standard subject with JavaScript frameworks is that pages can exist with and with out the trailing slash. Ideally, you’d choose the model you favor and make it possible for model has a self-referencing canonical tag after which redirect the opposite model to your most popular model.

With app shell fashions, little or no content material and code could also be proven within the preliminary HTML response. The truth is, each web page on the positioning might show the identical code, and this code could also be the very same because the code on another web sites. 

For those who see plenty of URLs with a low phrase rely in Website Audit, it could point out you’ve this subject. 

URLs by word count report in Ahrefs' Site Audit

This will typically trigger pages to be handled as duplicates and never instantly go to rendering. Even worse, the improper web page and even the improper website might present in search outcomes. This could resolve itself over time however might be problematic, particularly with newer web sites.

Don’t use fragments (#) in URLs

# already has an outlined performance for browsers. It hyperlinks to a different a part of a web page when clicked—like our “desk of contents” function on the weblog. Servers typically gained’t course of something after a #. So for a URL like abc.com/#one thing, something after a # is often ignored. 

JavaScript builders have determined they wish to use # because the set off for various functions, and that causes confusion. The most typical methods they’re misused are for routing and for URL parameters. Sure, they work. No, you shouldn’t do it.

JavaScript frameworks sometimes have routers that map what they name routes (paths) to clear URLs. Quite a lot of JavaScript builders use hashes (#) for routing. That is particularly an issue for Vue and a number of the earlier variations of Angular. 

To repair this for Vue, you possibly can work together with your developer to alter the next:

Vue router: 
Use ‘Historical past’ Mode as an alternative of the normal ‘Hash’ Mode.

const router = new VueRouter ({
mode: ‘historical past’,
router: [] //the array of router hyperlinks

There’s a rising development the place individuals are utilizing # as an alternative of ? because the fragment identifier, particularly for passive URL parameters like these used for monitoring. I are inclined to advocate towards it due to all the confusion and points. Situationally, I is perhaps OK with it eliminating plenty of pointless parameters.

Create a sitemap

The router choices that enable for clear URLs normally have an extra module that may additionally create sitemaps. You could find them by looking for your system + router sitemap, equivalent to “Vue router sitemap.” 

Lots of the rendering options may have sitemap choices. Once more, simply discover the system you utilize and Google the system + sitemap equivalent to “Gatsby sitemap,” and also you’re positive to discover a answer that already exists.

Standing codes and gentle 404s

As a result of JavaScript frameworks aren’t server-side, they will’t actually throw a server error like a 404. You’ve got a few totally different choices for error pages, such as:

  1. Utilizing a JavaScript redirect to a web page that does reply with a 404 standing code.
  2. Including a noindex tag to the web page that’s failing together with some form of error message like “404 Web page Not Discovered.” This shall be handled as a gentle 404 because the precise standing code returned shall be a 200 okay.

JavaScript redirects are OK, however not most popular

SEOs are used to 301/302 redirects, that are server-side. JavaScript is often run client-side. Server-side redirects and even meta refresh redirects shall be simpler for Google to course of than JavaScript redirects because it gained’t should render the web page to see them.

JavaScript redirects will nonetheless be seen and processed throughout rendering and ought to be OK usually—they’re simply not as ideally suited as different redirect varieties. They’re handled as everlasting redirects and nonetheless move all alerts like PageRank.

You’ll be able to usually discover these redirects within the code by on the lookout for “window.location.href”. The redirects might doubtlessly be within the config file as properly. Within the Subsequent.js config, there’s a redirect perform you should utilize to set redirects. In different methods, chances are you’ll discover them within the router.

Internationalization points

There are normally a number of module choices for various frameworks that assist some options wanted for internationalization like hreflang. They’ve generally been ported to the totally different methods and embrace i18n, intl or, many instances, the identical modules used for header tags like Helmet can be utilized so as to add the wanted tags.

We flag hreflang points within the Localization report in Website Audit. We additionally ran a examine and located that 67% of domains utilizing hreflang have points.

Hreflang issues shown in Ahrefs' Site Audit

You additionally should be cautious in case your website is obstructing or treating guests from a selected nation or utilizing a selected IP in several methods. This will trigger your content material to not be seen by Googlebot. If in case you have logic redirecting customers, chances are you’ll wish to exclude bots from this logic.

We’ll let you understand if that is occurring when establishing a mission in Website Audit.

Checking if JavaScript site is being redirected

Use structured information

JavaScript can be utilized to generate or to inject structured information in your pages. It’s fairly widespread to do that with JSON-LD and never prone to trigger any points, however run some checks to ensure every thing comes out such as you count on.

We’ll flag any structured information we see within the Points report in Website Audit. Search for the “Structured information has schema.org validation” error. We’ll inform you precisely what’s improper for every web page.

Making sure schema markup is valid

Use customary format hyperlinks

Hyperlinks to different pages ought to be within the internet customary format. Inner and exterior hyperlinks should be an <a> tag with an href attribute. There are various methods you can also make hyperlinks work for customers with JavaScript that aren’t search-friendly.


<a href=”/web page”>easy is nice</a>

<a href=”/web page” onclick=”goTo(‘web page’)”>nonetheless okay</a>


<a onclick=”goTo(‘web page’)”>nope, no href</a>

<a href=”javascript:goTo(‘web page’)”>nope, lacking hyperlink</a>

<a href=”javascript:void(0)”>nope, lacking hyperlink</a>

<span onclick=”goTo(‘web page’)”>not the appropriate HTML ingredient</span>

<possibility worth="web page">nope, improper HTML ingredient</possibility>

<a href=”#”>no hyperlink</a>

Button, ng-click, there are various extra methods this may be achieved incorrectly.

In my expertise, Google nonetheless processes most of the unhealthy hyperlinks and crawls them, however I’m undecided the way it treats them as far passing alerts like PageRank. The net is a messy place, and Google’s parsers are sometimes pretty forgiving.

It’s additionally value noting that inside hyperlinks added with JavaScript is not going to get picked up till after rendering. That ought to be comparatively fast and never a trigger for concern in most circumstances.

Use file versioning to unravel for inconceivable states being listed

Google closely caches all assets on its finish. I’ll discuss this a bit extra later, however it’s best to know that its system can result in some inconceivable states being listed. It is a quirk of its methods. In these circumstances, earlier file variations are used within the rendering course of, and the listed model of a web page might include components of older recordsdata.

You need to use file versioning or fingerprinting (file.12345.js) to generate new file names when important adjustments are made in order that Google has to obtain the up to date model of the useful resource for rendering.

You might not see what’s proven to Googlebot

You might want to alter your user-agent to correctly diagnose some points. Content material might be rendered in another way for various user-agents and even IPs. You must verify what Google really sees with its testing instruments, and I’ll cowl these in a bit.

You’ll be able to set a customized user-agent with Chrome DevTools to troubleshoot websites that prerender based mostly on particular user-agents, or you possibly can simply do that with our toolbar as properly.

Switching user-agent to troubleshoot SEO issues on JavaScript sites

Use polyfills for unsupported options

There might be options utilized by builders that Googlebot doesn’t assist. Your builders can use function detection. And if there’s a lacking function, they will select to both skip that performance or use a fallback technique with a polyfill to see if they will make it work.

That is principally an FYI for SEOs. For those who see one thing you suppose Google ought to be seeing and it’s not seeing it, it may very well be due to the implementation. 

Use lazy loading

Since I initially wrote this, lazy loading has principally moved from being JavaScript-driven to being dealt with by browsers.

You should still run into some JavaScript-driven lazy load setups. For essentially the most half, they’re in all probability nice if the lazy loading is for photographs. The primary factor I’d verify is to see if content material is being lazy loaded. Refer again to the “Verify if Google sees your content material” part above. These sorts of setups have induced issues with the content material being picked up accurately.

Infinite scroll points

If in case you have an infinite scroll setup, I nonetheless advocate a paginated web page model in order that Google can nonetheless crawl correctly.

One other subject I’ve seen with this setup is, sometimes, two pages get listed as one. I’ve seen this a number of instances when individuals stated they couldn’t get their web page listed. However I’ve discovered their content material listed as a part of one other web page that’s normally the earlier submit from them.

My concept is that when Google resized the viewport to be longer (extra on this later), it triggered the infinite scroll and loaded one other article in when it was rendering. On this case, what I like to recommend is to dam the JavaScript file that handles the infinite scrolling so the performance can’t set off.

Efficiency points

Quite a lot of the JavaScript frameworks deal with a ton of contemporary efficiency optimization for you.

The entire conventional efficiency greatest practices nonetheless apply, however you get some fancy new choices. Code splitting chunks the recordsdata into smaller recordsdata. Tree shaking breaks out wanted components, so that you’re not loading every thing for each web page such as you’d see in conventional monolithic setups. 

JavaScript setups achieved properly are a factor of magnificence. JavaScript setups that aren’t achieved properly might be bloated and trigger lengthy load instances.

Try our Core Internet Vitals information for extra about web site efficiency.

JavaScript websites use extra crawl finances 

JavaScript XHR requests eat crawl finances, and I imply they gobble it down. Not like most different assets which can be cached, these get fetched dwell through the rendering course of.

One other fascinating element is that the rendering service tries to not fetch assets that don’t contribute to the content material of the web page. If it will get this improper, chances are you’ll be lacking some content material.

Employees aren’t supported, or are they?

Whereas Google traditionally says that it rejects service employees and repair employees can’t edit the DOM, Google’s personal Martin Splitt indicated that you could be get away with utilizing internet employees typically.

Use HTTP connections

Googlebot helps HTTP requests however doesn’t assist different connection varieties like WebSockets or WebRTC. For those who’re utilizing these, present a fallback that makes use of HTTP connections.

JavaScript search engine optimisation testing instruments and troubleshooting

One “gotcha” with JavaScript websites is they will do partial updates of the DOM. Looking to a different web page as a person might not replace some facets like title tags or canonical tags within the DOM, however this might not be a problem for engines like google.

Google hundreds every web page stateless prefer it’s a recent load. It’s not saving earlier info and never navigating between pages.

I’ve seen SEOs get tripped up considering there’s a drawback due to what they see after navigating from one web page to a different, equivalent to a canonical tag that doesn’t replace. However Google might by no means see this state.

Devs can repair this by updating the state utilizing what’s referred to as the Historical past API. However once more, it might not be an issue. Quite a lot of time, it’s simply SEOs making hassle for the builders as a result of it appears to be like bizarre to them. Refresh the web page and see what you see. Or higher but, run it by certainly one of Google’s testing instruments to see what it sees.

Talking of its testing instruments, let’s discuss these.

Google testing instruments

Google has a number of testing instruments which can be helpful for JavaScript.

URL Inspection software in Google Search Console

This ought to be your supply of reality. While you examine a URL, you’ll get plenty of data about what Google noticed and the precise rendered HTML from its system.

Using URL Inspection tool to see what Google sees after it processes JavaScript

You’ve got the choice to run a dwell take a look at as properly. 

"Test Live URL" option in Google Search Console

There are some variations between the principle renderer and the dwell take a look at. The renderer makes use of cached assets and is pretty affected person. The dwell take a look at and different testing instruments use dwell assets, and so they lower off rendering early since you’re ready for a outcome. I’ll go into extra element about this within the rendering part later.

The screenshots in these instruments additionally present pages with the pixels painted, which Google doesn’t really do when rendering a web page.

The instruments are helpful to see if content material is DOM-loaded. The HTML proven in these instruments is the rendered DOM. You’ll be able to seek for a snippet of textual content to see if it was loaded in by default.

Searching for text within the DOM to make sure it's loaded by default on JavaScript sites

The instruments may even present you assets that could be blocked and console error messages, that are helpful for debugging.

For those who don’t have entry to the Google Search Console property for an internet site, you possibly can nonetheless run a dwell take a look at on it. For those who add a redirect by yourself web site on a property the place you’ve Google Search Console entry, then you possibly can examine that URL and the inspection software will observe the redirect and present you the dwell take a look at outcome for the web page on the opposite area. 

Within the screenshot under, I added a redirect from my website to Google’s homepage. The dwell take a look at for this follows the redirect and reveals me Google’s homepage. I don’t even have entry to Google’s Google Search Console account, though I want I did.

A hack to test a URL on a website you don't own

Wealthy Outcomes Take a look at software

The Wealthy Outcomes Take a look at software permits you to verify your rendered web page as Googlebot would see it for cell or for desktop.

Cellular-Pleasant Take a look at software

You’ll be able to nonetheless use the Cellular-Pleasant Take a look at software for now, however Google has introduced it’s shutting down in December 2023.

It has the identical quirks as the opposite testing instruments from Google.


Ahrefs is the one main search engine optimisation software that renders webpages when crawling the online, so we have now information from JavaScript websites that no different software does. We render ~200M pages a day, however that’s a fraction of what we crawl.

It permits us to verify for JavaScript redirects. We will additionally present hyperlinks we discovered inserted with JavaScript, which we present with a JS tag within the hyperlink stories:

Links added with JavaScript in Ahrefs' Site Explorer

Within the drop-down menu for pages in Website Explorer, we even have an examine possibility that permits you to see the historical past of a web page and examine it to different crawls. We’ve a JS marker there for pages that had been rendered with JavaScript enabled.

Pages crawled with JavaScript rendering in Ahrefs' Site Explorer

You’ll be able to allow JavaScript in Website Audit crawls to unlock extra information in your audits.

Enabling JavaScript rendering in Ahrefs' Site Audit

If in case you have JavaScript rendering enabled, we are going to present the uncooked and rendered HTML for each web page. Use the “magnifying glass” possibility subsequent to a web page in Web page Explorer and go to “View supply” within the menu. You can even examine towards earlier crawls and search throughout the uncooked or rendered HTML throughout all pages on the website.

Checking raw and JavaScript-rendered HTML in Ahrefs' Site Audit

For those who run a crawl with out JavaScript after which one other one with it, you should utilize our crawl comparability options to see variations between the variations.

Seeing changes between crawls in Ahrefs' Site Audit

Ahrefs’ search engine optimisation Toolbar additionally helps JavaScript and permits you to examine HTML to rendered variations of tags.

Ahrefs' SEO Toolbar shows differences between raw and rendered tags like title, description, canonical

View supply vs. examine

While you right-click in a browser window, you’ll see a few choices for viewing the supply code of the web page and for inspecting the web page. View supply goes to point out you an identical as a GET request would. That is the uncooked HTML of the web page.

Use "Inspect" over "View page source" when troubleshooting JavaScript SEO issues

Examine reveals you the processed DOM after adjustments have been made and is nearer to the content material that Googlebot sees. It’s the web page after JavaScript has run and made adjustments to it.

You must principally use examine over view supply when working with JavaScript.

Generally you could verify view supply

As a result of Google appears to be like at each uncooked and rendered HTML for some points, you should still have to verify view supply at instances. For example, if Google’s instruments are telling you the web page is marked noindex, however you don’t see a noindex tag within the rendered HTML, it’s doable that it was there within the uncooked HTML and overwritten.

For issues like noindex, nofollow, and canonical tags, chances are you’ll have to verify the uncooked HTML since points can carry over. Keep in mind that Google will take essentially the most restrictive statements it noticed for the meta robots tags, and it’ll ignore canonical tags while you present it a number of canonical tags.

Don’t browse with JavaScript turned off

I’ve seen this really useful means too many instances. Google renders JavaScript, so what you see with out JavaScript is by no means like what Google sees. That is simply foolish.

Don’t use Google Cache

Google’s cache is just not a dependable solution to verify what Googlebot sees. What you sometimes see within the cache is the uncooked HTML snapshot. Your browser then fires the JavaScript that’s referenced within the HTML. It’s not what Google noticed when it rendered the web page.

To complicate this additional, web sites might have their Cross-Origin Useful resource Sharing (CORS) coverage arrange in a means that the required assets can’t be loaded from a unique area.

The cache is hosted on webcache.googleusercontent.com. When that area tries to request the assets from the precise area, the CORS coverage says, “Nope, you possibly can’t entry my recordsdata.” Then the recordsdata aren’t loaded, and the web page appears to be like damaged within the cache.

The cache system was made to see the content material when an internet site is down. It’s not significantly helpful as a debug software.


How Google processes pages with JavaScript

Within the early days of engines like google, a downloaded HTML response was sufficient to see the content material of most pages. Because of the rise of JavaScript, engines like google now have to render many pages as a browser would to allow them to see content material as how a person sees it.

The system that handles the rendering course of at Google is known as the Internet Rendering Service (WRS). Google has supplied a simplistic diagram to cowl how this course of works.

Googlebot crawl render and indexing process diagram
Supply: Google.

Let’s say we begin the method at URL.

1. Crawler

The crawler sends GET requests to the server. The server responds with headers and the contents of the file, which then will get saved. The headers and the content material sometimes are available the identical request.

The request is prone to come from a cell user-agent since Google is on mobile-first indexing now, but it surely additionally nonetheless crawls with the desktop user-agent. 

The requests principally come from Mountain View (CA, U.S.), but it surely additionally does some crawling for locale-adaptive pages exterior of the U.S. As I discussed earlier, this could trigger points if websites are blocking or treating guests in a selected nation in several methods.

It’s additionally vital to notice that whereas Google states the output of the crawling course of as “HTML” on the picture above, in actuality, it’s crawling and storing the assets wanted to construct the web page just like the HTML, JavaScript recordsdata, and CSS recordsdata. There’s additionally a 15 MB max measurement restrict for HTML recordsdata.

2. Processing

There are plenty of methods obfuscated by the time period “Processing” within the picture. I’m going to cowl a number of of those which can be related to JavaScript.

Assets and hyperlinks

Google doesn’t navigate from web page to web page as a person would. A part of “Processing” is to verify the web page for hyperlinks to different pages and recordsdata wanted to construct the web page. These hyperlinks are pulled out and added to the crawl queue, which is what Google is utilizing to prioritize and schedule crawling.

Illustration showing Googlebot doesn't navigate like users

Google will pull useful resource hyperlinks (CSS, JS, and many others.) wanted to construct a web page from issues like <hyperlink> tags.

As I discussed earlier, inside hyperlinks added with JavaScript is not going to get picked up till after rendering. That ought to be comparatively fast and never a trigger for concern usually. Issues like information websites will be the exception the place each second counts.


Each file that Google downloads, together with HTML pages, JavaScript recordsdata, CSS recordsdata, and many others., goes to be aggressively cached. Google will ignore your cache timings and fetch a brand new copy when it needs to. I’ll speak a bit extra about this and why it’s vital within the “Renderer” part.

Illustration showing Google caches pages and resources

Duplicate elimination

Duplicate content material could also be eradicated or deprioritized from the downloaded HTML earlier than it will get despatched to rendering. I already talked about this within the “Duplicate content material” part above.

Most restrictive directives

As I discussed earlier, Google will select essentially the most restrictive statements between HTML and the rendered model of a web page. If JavaScript adjustments an announcement and that conflicts with the assertion from HTML, Google will merely obey whichever is essentially the most restrictive. Noindex will override index, and noindex in HTML will skip rendering altogether.

3. Render queue

One of many greatest issues from many SEOs with JavaScript and two-stage indexing (HTML then rendered web page) is that pages might not get rendered for days and even weeks. When Google appeared into this, it discovered pages went to the renderer at a median time of 5 seconds, and the ninetieth percentile was minutes. So the period of time between getting the HTML and rendering the pages shouldn’t be a priority in most circumstances.

Nonetheless, Google doesn’t render all pages. Like I discussed beforehand, a web page with a robots meta tag or header containing a noindex tag is not going to be despatched to the renderer. It gained’t waste assets rendering a web page it might’t index anyway.

It additionally has high quality checks on this course of. If it appears to be like on the HTML or can moderately decide from different alerts or patterns {that a} web page isn’t adequate high quality to index, then it gained’t trouble sending that to the renderer.

There’s additionally a quirk with information websites. Google needs to index pages on information websites quick so it might index the pages based mostly on the HTML content material first—and are available again later to render these pages.

4. Renderer

The renderer is the place Google renders a web page to see what a person sees. That is the place it’s going to course of the JavaScript and any adjustments made by JavaScript to the DOM.

Illustration of how JavaScript can change the DOM

For this, Google is utilizing a headless Chrome browser that’s now “evergreen,” which implies it ought to use the most recent Chrome model and assist the most recent options. Years in the past, Google was rendering with Chrome 41, and lots of options weren’t supported at that time.

Google has extra data on the WRS, which incorporates issues like denying permissions, being stateless, flattening mild DOM and shadow DOM, and extra that’s value studying.

Rendering at web-scale will be the eighth surprise of the world. It’s a critical enterprise and takes an amazing quantity of assets. Due to the size, Google is taking many shortcuts with the rendering course of to hurry issues up.

Cached assets

Google is relying closely on caching assets. Pages are cached. Information are cached. Almost every thing is cached earlier than being despatched to the renderer. It’s not going out and downloading every useful resource for each web page load, as a result of that might be costly for it and web site house owners. As an alternative, it makes use of these cached assets to be extra environment friendly.

The exception to that’s XHR requests, which the renderer will do in actual time.

There’s no five-second timeout

A standard search engine optimisation fable is that Google solely waits 5 seconds to load your web page. Whereas it’s at all times a good suggestion to make your website quicker, this fable doesn’t actually make sense with the way in which Google caches recordsdata talked about above. It’s already loading a web page with every thing cached in its methods, not making requests for recent assets.

Illustration of how resources from the page and file cache are sent to the WRS for rendering

If it solely waited 5 seconds, it might miss plenty of content material.

The parable seemingly comes from the testing instruments just like the URL Inspection software the place assets are fetched dwell as an alternative of cached, and they should return a outcome to customers inside an inexpensive period of time. It might additionally come from pages not being prioritized for crawling, which makes individuals suppose they’re ready a very long time to render and index them.

There isn’t a fastened timeout for the renderer. It runs with a sped-up timer to see if something is added at a later time. It additionally appears to be like on the occasion loop within the browser to see when all the actions have been taken. It’s actually affected person, and also you shouldn’t be involved about any particular time restrict.

It’s affected person, but it surely additionally has safeguards in place in case one thing will get caught or somebody is making an attempt to mine Bitcoin on its pages. Sure, it’s a factor. We had so as to add safeguards for Bitcoin mining as properly and even printed a examine about it.

What Googlebot sees

Googlebot doesn’t take motion on webpages. It’s not going to click on issues or scroll, however that doesn’t imply it doesn’t have workarounds. So long as content material is loaded within the DOM and not using a wanted motion, Google will see it. If it’s not loaded into the DOM till after a click on, then the content material gained’t be discovered.

Google doesn’t have to scroll to see your content material both as a result of it has a intelligent workaround to see the content material. For cell, it hundreds the web page with a display screen measurement of 411×731 pixels and resizes the size to 12,140 pixels

Primarily, it turns into a very lengthy telephone with a display screen measurement of 411×12140 pixels. For desktop, it does the identical and goes from 1024×768 pixels to 1024×9307 pixels. I haven’t seen any current checks for these numbers, and it could change relying on how lengthy the pages are.

Illustration showing Google doesn't scroll to see content

One other fascinating shortcut is that Google doesn’t paint the pixels through the rendering course of. It takes time and extra assets to complete a web page load, and it doesn’t actually need to see the ultimate state with the pixels painted. Apart from, graphics playing cards are costly between gaming, crypto mining, and AI.

Google simply must know the construction and the structure, and it will get that with out having to truly paint the pixels. As Martin places it:

In Google search we don’t actually care concerning the pixels as a result of we don’t actually wish to present it to somebody. We wish to course of the knowledge and the semantic info so we want one thing within the intermediate state. We don’t have to truly paint the pixels.

A visible might assist clarify what’s lower out a bit higher. In Chrome Dev Instruments, for those who run a take a look at on the “Efficiency” tab, you get a loading chart. The strong inexperienced half right here represents the portray stage. For Googlebot, that by no means occurs, so it saves assets.

Performance chart from Chrome Dev Tools

Grey = Downloads
Blue = HTML
Yellow = JavaScript
Purple = Format
Inexperienced = Portray

5. Crawl queue

Google has a useful resource that talks a bit about crawl finances. However it’s best to know that every website has its personal crawl finances, and every request must be prioritized. Google additionally has to stability crawling your pages vs. each different web page on the web.

Newer websites generally or websites with plenty of dynamic pages will seemingly be crawled slower. Some pages shall be up to date much less usually than others, and a few assets may be requested much less continuously.


JavaScript rendering choices

There are many choices on the subject of rendering JavaScript. Google has a strong chart that I’m simply going to point out. Any form of SSR, static rendering, and prerendering setup goes to be nice for engines like google. Gatsby, Subsequent, Nuxt, and many others., are all nice.

JavaScript rendering options
Supply: internet.dev.

Essentially the most problematic one goes to be full client-side rendering the place all the rendering occurs within the browser. Whereas Google will in all probability be OK client-side rendering, it’s greatest to decide on a unique rendering choice to assist different engines like google.

Bing additionally has assist for JavaScript rendering, however the scale is unknown. Yandex and Baidu have restricted assist from what I’ve seen, and lots of different engines like google have little to no assist for JavaScript. Our personal search engine, Yep, has assist, and we render ~200M pages per day. However we don’t render each web page we crawl.

There’s additionally the choice of dynamic rendering, which is rendering for sure user-agents. It is a workaround and, to be trustworthy, I by no means really useful it and am glad Google is recommending towards it now as properly.

Situationally, chances are you’ll wish to use it to render for sure bots like engines like google and even social media bots. Social media bots don’t run JavaScript, so issues like OG tags gained’t be seen except you render the content material earlier than serving it to them.

Virtually, it makes setups extra complicated and more durable for SEOs to troubleshoot. It’s positively cloaking, although Google says it’s not and that it’s OK with it.


For those who had been utilizing the previous AJAX crawling scheme with hashbangs (#!), do know this has been deprecated and is now not supported.

Remaining ideas

JavaScript is just not one thing for SEOs to worry. Hopefully, this text has helped you perceive learn how to work with it higher. 

Don’t be afraid to achieve out to your builders and work with them and ask them questions. They’re going to be your best allies in serving to to enhance your JavaScript website for engines like google.

Have questions? Let me know on Twitter.

Related Articles


Please enter your comment!
Please enter your name here

Latest Articles