Capture JavaScript Rendered Pages for SEO
In this article
JavaScript-rendered competitor pages often hide valuable SEO data—keywords, internal links, and content structure—that standard view-source or curl commands can't see. This guide shows you how to capture the fully rendered HTML of any competitor page using free, browser-based tools, so you can analyze what search engines actually see and improve your own strategy.
What You'll Need
- A modern web browser (Chrome, Firefox, or Edge)
- Basic familiarity with browser developer tools (F12)
- Optional: a free account with a rendering service like BrowserStack or a local Node.js environment if you prefer automation
Step-by-Step
- Open the competitor page in your browser. Use an incognito or private window to avoid cached data and extensions that might alter the page. Navigate to the exact URL you want to capture.
- Wait for the page to fully render. JavaScript may load content dynamically after the initial HTML. Wait until all images, lazy-loaded sections, and dynamic elements appear. Look for a stable network activity in the browser's Network tab (F12) to confirm no more requests are pending.
- Open Developer Tools and select the 'Elements' tab. Right-click anywhere on the page and choose 'Inspect' (or press F12). The Elements tab shows the current DOM—the fully rendered HTML, including any changes made by JavaScript.
- Right-click the topmost element and select 'Copy' → 'Copy outerHTML'. This copies the entire rendered DOM as it exists in memory, not just the original source.
- Paste the copied HTML into a text editor or a file. Save it as
rendered.htmlor similar. This is your captured snapshot. - Alternatively, use 'Save as' in the browser. In Chrome, press Ctrl+S (or Cmd+S on Mac) and choose 'Webpage, HTML Only'. This saves the rendered HTML, though it may also create a folder with assets. For a pure HTML snapshot, the copy-paste method is cleaner.
- For dynamic content that loads on scroll (infinite scroll), scroll to the bottom first. Many sites load more content as you scroll. If you need that content, scroll slowly to the bottom, wait for each batch to load, then copy the HTML.
- If the page requires login or has anti-bot measures, use a rendering service. Tools like BrowserStack or Puppeteer (via Node.js) can handle authentication and JavaScript execution in a controlled environment. For a quick one-off, the manual method above is sufficient.
- Verify the captured HTML. Open the saved file in a browser or text editor and search for elements that were clearly rendered by JavaScript (e.g., a product list that appears only after a script runs). If they're present, your capture is successful.
Common Mistakes
- Copying source code instead of the DOM. Viewing 'Page Source' (Ctrl+U) shows the original HTML, not the rendered version. Always use the Elements tab.
- Not waiting for all scripts to finish. If you copy too early, you'll miss dynamically injected content. Wait for the network tab to go quiet.
- Ignoring lazy-loaded content. Images and iframes may load only when scrolled into view. Scroll through the entire page before capturing.
- Using a browser with extensions that modify the page. Ad blockers or content scripts can remove or alter elements, giving you a false snapshot. Use incognito mode without extensions.
- Forgetting to capture after a client-side redirect. If the page uses JavaScript to redirect, wait until the final URL loads, then capture.
Tips
- Use the Network tab to identify all XHR/fetch requests. This helps you understand what data the page loads and ensures you've waited for all of them.
- For large pages, use the 'Copy outerHTML' method instead of 'Save as' to avoid saving hundreds of asset files.
- Automate with Puppeteer if you need to capture multiple pages. A simple script can open a URL, wait for a specified time, and save the HTML. This is more reliable for repeated captures.
- Check the rendered HTML for canonical tags and meta robots. These are often injected by JavaScript and are crucial for SEO analysis.
- Compare the rendered HTML with the raw source. The difference shows you exactly what JavaScript adds—this can reveal keywords or content strategies you might otherwise miss.
Troubleshooting
- Page shows blank or partial content after capture. This usually means you copied before JavaScript finished. Wait longer, or check the Network tab for pending requests. If the page uses WebSockets for real-time updates, you may need to capture after the initial load and ignore later updates.
- Copying outerHTML gives a huge file. That's normal for complex pages. You can use a text editor to search for specific elements or use a command-line tool like
grepto extract relevant sections. - The page uses a service worker that caches old content. In incognito mode, service workers are often disabled. If not, clear site data or use a different browser.
- You get a 403 or bot-detection page. Some sites block headless browsers or rapid requests. Try a different user agent, slow down, or use a real browser with a human-like delay. For serious scraping, consider a paid rendering service.
- The captured HTML doesn't include styles or images. That's expected—you only need the HTML structure for SEO analysis. Styles and images are separate resources.
Frequently Asked Questions
Is this legal for competitor analysis?
Capturing a public page for your own analysis is generally acceptable, but you should respect the site's terms of service and robots.txt. Avoid heavy scraping that could overload their server.
Can I capture pages that require a login?
Yes, but you'll need to authenticate first. Using a rendering service or a script that logs in before capturing works. Be mindful of account terms and never share credentials.
Does this work for single-page applications (SPAs)?
Yes, this method captures the final DOM after all client-side routing and rendering, which is exactly what you need for SPAs.
How is this different from viewing page source?
Page source shows the raw HTML sent by the server, which may be mostly empty for JS-heavy sites. The rendered DOM includes everything JavaScript adds or modifies.
Can I use this to see what Google sees?
Not exactly—Google renders pages with its own headless browser, which may differ from your browser. But capturing the rendered DOM gives you a close approximation of the content that matters for SEO.
What if the page uses infinite scroll?
Scroll to the bottom slowly, wait for each batch to load, then copy. For very long pages, you may need to repeat the scroll-and-copy process or use a script that auto-scrolls.