I issue a message like this via DevTools Protocol to a running Google Chrome instance:
{
"id": 0,
"method": "Fetch.enable",
"params": {
"patterns": [{
"urlPattern": "*.js*",
"resourceType": "Script",
"requestStage": "Response"
}
]
}
}
I was expecting it would cause "Fetch.requestPaused" event for each script file downloaded by a page. It works only for the resources provided in the <head>
section of the page, like <script src="..."/>
If the <script src="..."/>
is included in any other part of the page (ie. outside of header) it is not being intercepted and no "Fetch.requestPaused" event is issued. Anyone knows how to intercept those reuests (I need to modify the responses before they get to the browser).