Click here to Skip to main content
14,698,883 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I use puppeteer to get the response of an image on a web page. It still works fine until that image redirects from http to https
I have read this post but only get https url, and I don't know how to get its response. Is there any way? Thanks!
page.on('response', async (response) => {
  const status = response.status()
  if ((status >= 300) && (status <= 399)) {
    console.log('Redirect from', response.url(), 'to', response.headers()['location'])
  }
});


What I have tried:

I have read this post but it just returns redirect url: javascript - Puppeteer get request redirects - Stack Overflow[^]
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900