{"id":2495,"date":"2024-03-13T07:39:46","date_gmt":"2024-03-13T07:39:46","guid":{"rendered":"https:\/\/ewebtoolz.com\/blog\/how-to-search-through-the-source-code-of-the-entire-website\/"},"modified":"2024-03-13T07:39:46","modified_gmt":"2024-03-13T07:39:46","slug":"how-to-search-through-the-source-code-of-the-entire-website","status":"publish","type":"post","link":"https:\/\/ewebtoolz.com\/blog\/how-to-search-through-the-source-code-of-the-entire-website\/","title":{"rendered":"How to Search Through the Source Code of the Entire Website"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div>\n<div>\n<div class=\"author-desktop\">\n<div class=\"post-navigation2\">\n<div id=\"fright\" class=\"share-post-top-bottom subscr-fright\">\n<p>Get the week&#8217;s best marketing content<\/p>\n<\/div><\/div>\n<\/div>\n<\/div>\n<p> <span><\/p>\n<p><a href=\"https:\/\/ahrefs.com\/site-audit\">Ahrefs Site Audit<\/a>, also available as part of the free <a href=\"https:\/\/ahrefs.com\/webmaster-tools\">Ahrefs Webmaster Tools<\/a>, allows you to search through the raw HTML code or the JS-rendered code across <strong>all<\/strong> crawled pages of the website.<\/p>\n<p>This feature is particularly useful when you need to verify analytics tags, identify pages that call certain scripts or stylesheets, detect unwanted injections into the page code, or research the competitors\u2019 technologies.<\/p>\n<p>It is important to understand that in the era of JavaScript-powered websites, the page code can exist in two\u00a0forms:<\/p>\n<p><strong>Raw (Source)<\/strong>: the HTML code before any JavaScript on the page has been executed. This is what you see using the \u201c<a href=\"https:\/\/support.google.com\/surveys\/answer\/6172725?hl=en\" rel=\"noopener\" target=\"_blank\">View Page Source<\/a>\u201d feature in the browser.<\/p>\n<p><strong>Rendered<\/strong>: the final HTML code after being altered\/generated by JavaScript. It is visible in the \u201c<a href=\"https:\/\/support.google.com\/webmasters\/answer\/11626894?hl=en\" rel=\"noopener\" target=\"_blank\">Inspect<\/a>\u201d mode in the browser.<\/p>\n<p>The source and rendered versions can be significantly different, so it\u2019s important to ensure you\u2019re searching through the correct version of the page\u00a0code.<\/p>\n<h2>How to search through the rendered code of the\u00a0pages<\/h2>\n<p>If you need to search through the JS-rendered HTML code of all the pages on the website, run a crawl in Site Audit or Ahrefs Webmaster Tools. Ensure that the \u201cExecute JavaScript\u201d option is activated in the crawl settings.<\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Execute-JavaScript-settings.png\" alt=\"Execute JavaScript setting\" width=\"1546\" height=\"1304\" class=\"alignnone size-full wp-image-172760\" srcset=\"https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Execute-JavaScript-settings.png 1546w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Execute-JavaScript-settings-504x425.png 504w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Execute-JavaScript-settings-768x648.png 768w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Execute-JavaScript-settings-1536x1296.png 1536w\" sizes=\"(max-width: 1546px) 100vw, 1546px\"\/><\/p>\n<p>Once the crawl is complete, go to the <strong>Page Explorer<\/strong> and access the <strong>Advanced filter<\/strong>. Select \u2018Page source\u2019 followed by \u2018Contains\u2019 from the dropdown menu. Then, enter the specific piece of code you are searching for.<\/p>\n<p><noscript><img decoding=\"async\" src=\"https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Advanced-filter.jpg\" alt=\"Advanced filter\" width=\"2452\" height=\"1352\" class=\"alignnone size-full wp-image-172761\" srcset=\"https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Advanced-filter.jpg 2452w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Advanced-filter-680x375.jpg 680w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Advanced-filter-768x423.jpg 768w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Advanced-filter-1536x847.jpg 1536w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Advanced-filter-2048x1129.jpg 2048w\" sizes=\"(max-width: 2452px) 100vw, 2452px\"\/><\/noscript><img decoding=\"async\" src=\"https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Advanced-filter.jpg\" alt=\"Advanced filter\" width=\"2452\" height=\"1352\" class=\"lazyload alignnone size-full wp-image-172761\" srcset=\"https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Advanced-filter.jpg 2452w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Advanced-filter-680x375.jpg 680w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Advanced-filter-768x423.jpg 768w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Advanced-filter-1536x847.jpg 1536w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Advanced-filter-2048x1129.jpg 2048w\" data-sizes=\"(max-width: 2452px) 100vw, 2452px\"\/><\/p>\n<p>The example above finds all pages on our blog that that contain an embedded table.<\/p>\n<h2>How to search through the raw HTML of the\u00a0pages<\/h2>\n<p>Searching through the raw HTML (also called source HTML) requires a few extra actions:<\/p>\n<h4>1. Disable JavaScript rendering in the crawl settings<\/h4>\n<p><noscript><img decoding=\"async\" src=\"https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Execute-JavaScript-setting-off.png\" alt=\"Execute JavaScript setting - off\" width=\"1526\" height=\"1294\" class=\"alignnone size-full wp-image-172764\" srcset=\"https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Execute-JavaScript-setting-off.png 1526w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Execute-JavaScript-setting-off-501x425.png 501w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Execute-JavaScript-setting-off-768x651.png 768w\" sizes=\"(max-width: 1526px) 100vw, 1526px\"\/><\/noscript><img decoding=\"async\" src=\"https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Execute-JavaScript-setting-off.png\" alt=\"Execute JavaScript setting - off\" width=\"1526\" height=\"1294\" class=\"lazyload alignnone size-full wp-image-172764\" srcset=\"https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Execute-JavaScript-setting-off.png 1526w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Execute-JavaScript-setting-off-501x425.png 501w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Execute-JavaScript-setting-off-768x651.png 768w\" data-sizes=\"(max-width: 1526px) 100vw, 1526px\"\/><\/p>\n<h4>2. Ensure discoverability of all pages by the crawler.<\/h4>\n<p>This is crucial for websites where page content (including the internal links) is generated via JavaScript, as AhrefsSiteAudit bot may not automatically discover all pages via raw HTML\u00a0code.<\/p>\n<p>That\u2019s why you need to supply the Site Audit tool with a list of input URLs that we call \u201cSeeds.\u201d<\/p>\n<p>The easiest way to do that is to make sure that the Sitemaps are used in the \u201cURL Sources.\u201d If that\u2019s not feasible, use the Custom URL\u00a0list.<\/p>\n<p><noscript><img decoding=\"async\" src=\"https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/URL-Sources.png\" alt=\"URL Sources\" width=\"1626\" height=\"1328\" class=\"alignnone size-full wp-image-172765\" srcset=\"https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/URL-Sources.png 1626w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/URL-Sources-520x425.png 520w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/URL-Sources-768x627.png 768w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/URL-Sources-1536x1254.png 1536w\" sizes=\"(max-width: 1626px) 100vw, 1626px\"\/><\/noscript><img decoding=\"async\" src=\"https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/URL-Sources.png\" alt=\"URL Sources\" width=\"1626\" height=\"1328\" class=\"lazyload alignnone size-full wp-image-172765\" srcset=\"https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/URL-Sources.png 1626w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/URL-Sources-520x425.png 520w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/URL-Sources-768x627.png 768w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/URL-Sources-1536x1254.png 1536w\" data-sizes=\"(max-width: 1626px) 100vw, 1626px\"\/><\/p>\n<p>When the crawl is finished, use the advanced filter to search through the source code of all crawled pages.<\/p>\n<p><noscript><img decoding=\"async\" src=\"https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Example-2.png\" alt=\"\" width=\"2814\" height=\"1054\" class=\"alignnone size-full wp-image-172766\" srcset=\"https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Example-2.png 2814w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Example-2-680x255.png 680w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Example-2-768x288.png 768w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Example-2-1536x575.png 1536w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Example-2-2048x767.png 2048w\" sizes=\"(max-width: 2814px) 100vw, 2814px\"\/><\/noscript><img decoding=\"async\" src=\"https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Example-2.png\" alt=\"\" width=\"2814\" height=\"1054\" class=\"lazyload alignnone size-full wp-image-172766\" srcset=\"https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Example-2.png 2814w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Example-2-680x255.png 680w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Example-2-768x288.png 768w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Example-2-1536x575.png 1536w, https:\/\/ahrefs.com\/blog\/wp-content\/uploads\/2024\/03\/Example-2-2048x767.png 2048w\" data-sizes=\"(max-width: 2814px) 100vw, 2814px\"\/><\/p>\n<p> <\/span><\/div>\n<p><br \/>\n<br \/><a href=\"https:\/\/ahrefs.com\/blog\/search-source-code\/\">Source link <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Get the week&#8217;s best marketing content Ahrefs Site Audit, also available as part of the free Ahrefs Webmaster Tools, allows you to search through the raw HTML code or the JS-rendered code across all crawled pages of the website. This feature is particularly useful when you need to verify analytics tags, identify pages that call [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2496,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[],"class_list":["post-2495","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-seo"],"_links":{"self":[{"href":"https:\/\/ewebtoolz.com\/blog\/wp-json\/wp\/v2\/posts\/2495","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ewebtoolz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ewebtoolz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ewebtoolz.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ewebtoolz.com\/blog\/wp-json\/wp\/v2\/comments?post=2495"}],"version-history":[{"count":0,"href":"https:\/\/ewebtoolz.com\/blog\/wp-json\/wp\/v2\/posts\/2495\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ewebtoolz.com\/blog\/wp-json\/wp\/v2\/media\/2496"}],"wp:attachment":[{"href":"https:\/\/ewebtoolz.com\/blog\/wp-json\/wp\/v2\/media?parent=2495"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ewebtoolz.com\/blog\/wp-json\/wp\/v2\/categories?post=2495"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ewebtoolz.com\/blog\/wp-json\/wp\/v2\/tags?post=2495"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}