exclusive-coralE
Apify & Crawlee3y ago
2 replies
exclusive-coral

Blocking requests after click

I am using
preNavigationHooks
to block images, which works for the initial page load but does not block images loaded after a click on the page (i.e. XHR requests). How can these be blocked?

preNavigationHooks: [
    async ({ page, blockRequests }) => {
        await page.setViewportSize({ width: 1920, height: 1080 })
        await blockRequests({
            urlPatterns: [".jpg", ".png", ".gif", ".svg"],
        })
    },
],
Was this page helpful?