Google says some JavaScript can still be blocked in robots.txt
Google says it is generally fine to block an age-verification popup from rendering for Googlebot with robots.txt, if the page still works properly.
Google has clarified that blocking some JavaScript resources with robots.txt can be acceptable in specific cases, including an age-verification popup that visitors must see. According to Search Engine Journal, Google’s John Mueller said this would generally work as long as the page still loads properly when Googlebot cannot fetch the blocked resource.
The clarification came in response to a question about a popup loaded from a separate domain through an API. The issue matters because Google has long expected site owners to let Googlebot access resources needed to render what users see, and some sites have previously lost rankings when critical resources stayed blocked.
What changed
Mueller confirmed that an age-verification popup can be kept from rendering for Googlebot by using robots.txt in two different ways. If the popup comes from another domain, the robots.txt file on that external domain can disallow crawling, which stops Googlebot from fetching the resource during rendering.
He also described a second option for cases where the external domain’s robots.txt is not under the site owner’s control. In that setup, a site can block the specific JavaScript file that loads the popup. Mueller cautioned against blocking a single JavaScript file if that file handles many other functions on the site.
What it means for your website
For most business websites, this is a narrow technical clarification, not a broad permission to hide visible page elements from Google. The key point is that Google appears to allow this for the kind of legally required age-verification popup described in the question.
The practical limit is simple: do not block resources that your pages need in order to load or work correctly. Mueller said Googlebot will not use blocked resources during rendering, so if a blocked script affects more than the popup itself, the page may not render as expected in Google’s systems.
What to do now
- If your site uses an age-verification popup, identify whether it is loaded from a separate domain or from a JavaScript file on your own site.
- If the popup is on another domain, check whether that domain’s robots.txt can block Googlebot from fetching the popup resource.
- If you cannot control the external domain, see whether a specific JavaScript file on your site loads the popup, and avoid blocking broader scripts that do other jobs.
- Test that your pages still load properly when the popup resource is blocked, because Googlebot will not render what it cannot fetch.
- If your site does not use this kind of popup, no immediate action is needed. Just continue to avoid blocking critical CSS or JavaScript that pages need for normal rendering.
More from SEO News
All SEO News-
· Search Engine Journal
Google May Be Limiting Search Result Redirect Resolution
-
· Search Engine Journal
Google Clarifies How Redirects Pass Ranking Signals
-
· Search Engine Journal
Google AI Mode Adds Home Service Booking and Quote Links
-
· Search Engine Journal
PageSpeed Insights scores may change after Lighthouse 13.6 update