Ahrefs Site Audit, also available as part of the free Ahrefs Webmaster Tools, lets you search raw HTML code or JS rendered code on All scanned pages of the website.
This feature is especially useful when you need to check analytics tags, identify pages that call certain scripts or style sheets, detect unwanted injections into the page’s code, or research competing technologies.
It is important to understand that in the age of JavaScript-based websites, page code can exist in two forms:
Raw (source): The HTML code before any JavaScript runs on the page. This is what you see using the “View Page Source” feature in your browser.
Returns: The final HTML code after being modified/generated by JavaScript. It is visible in the “Inspect” mode in the browser.
The source and displayed versions can be significantly different, so it’s important to make sure you’re searching in the correct version of the page’s code.
How to search the rendered code of pages
If you need to search the JS-rendered HTML code of all pages on the website, run a scan in Site Audit or Ahrefs Webmaster Tools. Make sure the “Run JavaScript” option is enabled in your scan settings.
Once the scan is complete, go to Explore pages and log in to Advanced filter. Select “Page Source” followed by “Contains” from the drop-down menu. Then, enter the specific piece of code you’re looking for.
The example above finds all pages on our blog that contain an embedded table.
How to search raw HTML on pages
Searching raw HTML (also called source HTML) requires some additional actions:
1. Disable JavaScript rendering in the scan settings
2. Ensure all pages are discoverable by the crawler.
This is critical for websites where the page content (including internal links) is generated via JavaScript, as the AhrefsSiteAudit bot may not automatically detect all pages via raw HTML code.
That’s why you need to provide the Site Audit tool with a list of input URLs that we call “Seeds”.
The easiest way to do this is to ensure that Sitemaps are used in “URL Sources”. If this isn’t feasible, use the Custom URLs list.
Once the scan is complete, use the advanced filter to search the source code of all scanned pages.