Sub topic 11
Crawling JavaScript-dependent pages with rendering
This chapter assumes you have run a first crawl, can read the Internal tab, and know the basics from earlier chapters on scoping a crawl. You should also know what a canonical tag, a title tag and an internal link are. You do not need to know how to write JavaScript.
Why rendering matters
By default the SEO Spider works in Text Only mode. It downloads the raw HTML that the server sends, reads it, and follows the links it finds there. This is fast and light on memory. It works well for sites where the content is in the HTML source.
Many modern sites are different. The server sends a small HTML shell, and JavaScript running in the browser builds the real page: the headings, the body text and often the navigation links. A crawler that only reads the raw HTML sees a nearly empty page.
In JavaScript rendering mode the SEO Spider loads each page in an embedded headless Chrome browser, waits for scripts to run, and then reads the resulting page. This final version is called the rendered HTML. The HTML the server sent is the raw HTML. Comparing the two is the core skill of this chapter.
| Term | Meaning |
|---|---|
| Raw HTML | The response body exactly as the server sent it, before any script runs |
| Rendered HTML | The page's DOM (Document Object Model) after scripts have run, serialised back to HTML |
| Text Only mode | Crawls raw HTML only. Fast, low memory |
| JavaScript mode | Crawls rendered HTML using headless Chrome. Slower, heavier |
Deciding whether you need rendering
Do not turn rendering on for every crawl. It is slower, often by several times, and it uses more memory and more requests, because the browser also fetches scripts, stylesheets and images.
Run a Text Only crawl first, then look for signs that the site depends on JavaScript:
- Pages have very low word counts in the Content tab, or an empty body.
- Internal tab shows very few URLs, even though you know the site has thousands.
- Titles, meta descriptions or H1s are missing in the crawl, but visible in your browser.
- The crawl stops after the home page because navigation links do not exist in the raw HTML.
- The site is a single-page application built with a framework such as React, Vue or Angular.
You can also check manually. In your browser, view the page source (the raw HTML) and compare it with the Elements panel in developer tools (the rendered DOM). If the content you care about appears only in the second, rendering matters for that site.
Turning rendering on
- Open Configuration > Spider > Rendering.
- Change Rendering from Text Only to JavaScript.
- Leave the rendering engine on Chrome, which is the supported option.
- Choose a Window Size. The default presets include Googlebot Mobile: Smartphone, Googlebot Desktop, and custom sizes. Choose Googlebot Mobile if you want to approximate what Google sees, since Google indexes mobile-first.
- Click OK and start the crawl.
JavaScript rendering is a crawl setting, so it should be set before you start. Changing it mid-crawl produces mixed data.
Settings that change the result
| Setting | What it does | When to change it |
|---|---|---|
| AJAX timeout | How many seconds the Spider waits for the page to finish loading and running scripts. Default is 5 | Raise it if content appears late or the page times out |
| Window size | Viewport used by the headless browser | Match the device you want to test. Layout-dependent scripts may behave differently by size |
| Store HTML and Rendered HTML | Saves both versions for each URL so you can compare them | Turn on during debugging. It increases storage use |
| Enable rendered page screenshots | Captures a screenshot of each rendered page | Useful for spotting blank or broken layouts |
| Flatten Shadow DOM and iframes | Includes content inside shadow DOM and iframes in the rendered HTML | Turn on if the site uses web components |
Verifying the rendered output
Never assume rendering worked because the crawl finished. Verify it on a sample of URLs.
- Select a URL in the Internal tab.
- In the lower URL Details pane, open the Rendered Page tab to see the screenshot of what the browser produced. A blank or partial screenshot means scripts failed or timed out.
- Open View Source and compare Original HTML with Rendered HTML. A view that highlights differences makes it clear what scripts added.
- Check the JavaScript filters in the main tab list. These report problems such as pages that have different titles or canonicals after rendering, and pages where links only appear after rendering.
Blocked resources
Headless Chrome obeys robots.txt for the scripts, stylesheets and API calls the page requests. If your robots.txt blocks /static/js/ or an API path, the page may render empty. Look at the Response Codes tab and the Blocked Resource filter. Fix the robots.txt rule if the blocked file is needed to build content. Google has the same limitation, so a blocked script is a real indexing risk and not only a crawler quirk.
Common problems and how to fix them
Pages render blank or incomplete
The usual causes are a timeout that is too short, blocked resources, or scripts that need a login or cookie. Raise the AJAX timeout, check blocked resources, and test the page in a normal browser with the same conditions.
Fragment URLs
Older single-page applications used hash fragments, such as /#/products. Servers never receive the part after #, and Google does not treat fragments as separate pages. The Spider normally ignores fragments, so a site built this way may look like it has one URL. The fix belongs in the site: use real paths through the History API.
Links added by click events
The Spider follows real <a href> links in the rendered HTML. It does not click buttons or fire handlers. If navigation depends on a onclick event with no href, those pages will not be discovered. Search engines have the same limit, so treat this as a site problem to fix and not only a crawling issue.
Lazy-loaded content
Content that loads only after scrolling or interaction may not appear. The Spider does not scroll like a user would. If images or sections that should be indexed are missing, the site's lazy loading may need to use standard browser methods that do not require interaction.
Canonicals or noindex changed by JavaScript
A script can change a canonical tag, or add or remove a noindex directive, after the page loads. Raw and rendered HTML then disagree. Google may use either, so conflicting signals are risky. The safest approach is to put indexing directives in the raw HTML and not rely on scripts to change them.
Using the compare view for a real audit
A practical workflow for a suspect site:
- Crawl a sample of 50 to 100 URLs with Text Only and save the crawl.
- Crawl the same URLs with JavaScript rendering and Store HTML and Store Rendered HTML both on.
- Compare word counts, titles, H1s and inlink counts between the two.
- Open the rendered view for pages with the biggest differences.
- List what the raw HTML lacks that matters for search: main content, links, structured data, canonicals.
If the raw HTML already holds all of this, you do not need rendering for the full crawl, and Text Only will be faster. If it does not, rendering is the right choice, and you should also tell the developers that search engines have to render the pages to see their content. Server-side rendering or pre-rendering is the more reliable option for search, because it does not depend on a second processing step.
Performance and storage
Rendering consumes much more memory per URL. For crawls above a few hundred thousand URLs, use database storage mode, which a later chapter covers, and keep rendered HTML storage off unless you need it. Reduce threads if the machine struggles. Consider excluding large non-essential resources, such as third-party tracking scripts, with an Exclude rule so the browser does not spend time on them.
Exercise
A crawl in Text Only mode finds 12 URLs on a site that you know has about 4,000 pages, and most pages show an empty H1 and a word count under 20. What is your next step, and how do you confirm the fix worked?
Show answer
The site is probably built with JavaScript that creates content and links after load. Switch Configuration > Spider > Rendering to JavaScript, set the window size to Googlebot Mobile, and recrawl a sample. Confirm it worked by selecting URLs, checking the Rendered Page screenshot and the Rendered HTML view, and seeing that word counts, H1s and the URL count rise. If pages are still blank, raise the AJAX timeout and check the Blocked Resource filter for robots.txt rules that block scripts.
Exercise
A page's raw HTML has no noindex tag, but a script adds one after load. Which version does the Spider report in JavaScript mode, and why is this a risk?
Show answer
In JavaScript mode the Spider reports the rendered version, so it shows noindex. This is a risk because raw and rendered HTML give conflicting signals, and a search engine may act on either. Put indexing directives in the raw HTML so they do not depend on scripts.