Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Prefetch requests have the wrong type in onBeforeRequest

93 views
Skip to first unread message

Peter Bloomfield

unread,
Mar 17, 2025, 12:26:13 PMMar 17
to Chromium Extensions
There seems to have been a change recently in how prefetch requests are reported to the "chrome.webRequest.onBeforeRequest" handler. In the past, the "type" property was set to "other" for prefetches, but now it seems to be set to "main_frame", at least under some circumstances. We've noticed this in Chrome v134.0.6998.89 running on Windows, but it may have started happening in previous versions.

Does anyone know if this is a deliberate change, or is it a bug?

Rough steps to reproduce:

1. Ensure prefetch / network prediction hasn't been disabled in your browser (it's usually enabled by default).
2. Create an extension which registers the onBeforeRequest handler.
3. In the handler, output the request details to the console.
4. Load the extension into the browser.
5. Go to Google.com and search for something generic like "facebook", but don't click on any of the results.

In the extension console, you will see a request with type "main_frame" relating to the original search. That's expected behaviour. However, you will often also see another "main_frame" request for one of the top search results, such as "facebook.com" in the above example. It comes from the same tab and frame as the search, so it makes it look as though you actually navigated to the site.

This is causing us a problem because we use onBeforeRequest to provide web-filtering in an enterprise environment. Users are essentially getting blamed for accessing things that they never clicked on.

Peter Bloomfield

unread,
Mar 19, 2025, 4:23:56 AMMar 19
to Chromium Extensions, Peter Bloomfield
It looks like this has already been logged as a bug:

Reply all
Reply to author
Forward
0 new messages