example 'block images' - fix typo and add other extensions (#334)

* fix typo and add extensions to example 'block images'

* fix code style, keep the newline at EOF
This commit is contained in:
Noriaki UCHIYAMA 2017-08-18 01:39:40 +09:00 committed by Eric Bidelman
parent 2655f20fd3
commit 21aa0a2390

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$)/.test(request.url)) if (/\.(png|jpg|jpeg|gif|webp)$/.test(request.url))
request.abort(); request.abort();
else else
request.continue(); request.continue();