John Mueller: Robots.txt Can Hide a Popup From Googlebot
Two ways to keep a legally required popup out of Google's rendering, and one setup where he'd leave it alone.

Google’s John Mueller says robots.txt can stop Googlebot from rendering an age-verification popup that visitors must see, and he laid out two ways to do it on Reddit.
Both keep Googlebot away from the popup script. He also named one case where he wouldn’t.
Got a popup you’d rather Google didn’t read?
The question on Reddit
A site owner described a hypothetical site with an age-verification popup it shows for legal reasons. The popup sits on a separate domain and is inserted into the page through an API.
So would a disallow in that other domain’s robots.txt stop Google from rendering the popup?
Mueller’s short answer: “That would generally work.”
You could also disallow the specific JavaScript file that loads the popup, he added. But if one script does lots of jobs on your site, he said he wouldn’t.
Mueller’s two options
He came back hours later with more detail, as Search Engine Roundtable reported.
- Block the popup’s domain. If that domain disallows all crawling, Googlebot won’t fetch its script or iframe while rendering your page.
- Block your own popup script. Say you load it with load-verification-popup.js: disallow that file in your robots.txt.
The first option is how many ad services work, he said. It depends on the provider’s robots.txt.
Then there’s the second. It’s less common in his experience, but it’s the route when you can’t change the provider’s robots.txt, because the file you block sits on your own domain.
One condition covers both. Your pages still have to load when those URLs aren’t fetched, and for a popup like this, Mueller said that’s usually not a problem.
Why this sounds new
For years, Google has asked sites to let Googlebot fetch everything a visitor sees.
Search Engine Journal points out that some sites which kept blocking critical resources temporarily lost rankings once Google started rendering pages.
So the question was fair. SEJ reads the answer as a sign Google is looser than it used to be, at least toward an age gate.
Why it matters
An age gate is the one thing on the page you’d want Googlebot to skip. Who has one?
- online shops selling alcohol or vapes
- gambling and sports betting sites
- sites that host adult content
They now have a Google answer to point to.
But read the scope carefully. He was talking about one popup script on its own.
If you block a file that also builds your menu or loads your products, you could hide real content from Google and repeat the rendering mistake that cost some sites rankings.
Before you touch robots.txt, I’d run three checks:
- Does the popup load from its own file, apart from everything else?
- With that file blocked, does the page still render fully in URL Inspection?
- Is the file on your domain, or on the provider’s?
My read: it’s useful, but narrow. If your popup lives inside one big bundled script, ask your developer to split it out first, then block only the popup file.
Still, robots.txt only stops crawlers that choose to follow it.
The fake Googlebots scraping sites for AI won’t care. Doing a technical SEO audit? Add blocked scripts to the list.
Test first. Block second.
Common Questions
Can I block JavaScript files with robots.txt without hurting SEO?
Google’s John Mueller says blocking the specific JavaScript file that loads an age-verification popup generally works. Your pages still have to load properly when that file isn’t fetched, and he said he wouldn’t block a single script that does lots of different jobs on your site.
How do I stop Googlebot from rendering a popup?
If the popup sits on a separate domain that disallows all crawling, Googlebot won’t fetch it while rendering your page. If you load it with your own popup script, disallow that file in your robots.txt.
Will Googlebot index my age-verification popup?
It can, if Googlebot fetches the popup script while rendering your page. Mueller says a disallow in robots.txt stops that, whether it sits on your own domain and blocks your own popup file or sits on the provider’s domain and blocks all crawling of the popup they serve to your visitors.