example 'block images' - make extension check case insensitive (#401)

This commit is contained in:
Florian Reuschel 2017-08-20 23:33:22 +02:00 committed by Andrey Lushnikov
parent 9ede3144c5
commit 3b03fdd2d0

View File

@ -22,7 +22,7 @@ const browser = await puppeteer.launch();
const page = await browser.newPage(); const page = await browser.newPage();
await page.setRequestInterceptionEnabled(true); await page.setRequestInterceptionEnabled(true);
page.on('request', request => { page.on('request', request => {
if (/\.(png|jpg|jpeg|gif|webp)$/.test(request.url)) if (/\.(png|jpg|jpeg|gif|webp)$/i.test(request.url))
request.abort(); request.abort();
else else
request.continue(); request.continue();