-
Hello, How can I block google-analytics from loading using the setRequestInterception()? I see in your tests you cover can_intercept_requests() it by blocking by resourceType() === 'stylesheet'. puphpeteer/tests/PuphpeteerTest.php Lines 88 to 103 in d3f9397 I'm not very familiar with the "on request" event (I guess it's an event). Can't figure out how to block certain resources, for example google-analytics. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Well, to answer my own question. I managed to block it with the following code
I'm putting this here as a solution for others. if you need to block more urls, add more comma separated strings in the javascript array ['google-analytics', 'something else', 'etc']. I guess it could also work in the first if block by making an array of extensions ['.jpg', '.png', '.gif'] and use the some() to iterate the items |
Beta Was this translation helpful? Give feedback.
Well, to answer my own question.
I managed to block it with the following code
I'm…