Open Gamewise opened 8 months ago
how did u resolve it
I didn't sorry. I just didn't use it with other sites in the end.
anyone have any luck im using function downloadScreenshot(element) { const fetchOptions = { requestInit: { mode: 'cors', }, bypassingCache: true, };
// Use modern-screenshot to capture the image with fetch options
modernScreenshot.domToPng(element, { fetch: fetchOptions }).then(dataUrl => {
const link = document.createElement('a')
link.download = 'screenshot.png'
link.href = dataUrl
link.click()
})
-and the image isnt showing up in the screenshot
What worked for me was using "no-cache"
:
return await domToPng(node, {
fetch: {
requestInit: {
cache: "no-cache",
},
},
});
I also encountered this problem, how did you solve it?
Hi there!
I'm having trouble downloading all cross-origin images. Some urls seem to work and some don't and I'm getting CORS errors.
I can get most images to display on my website, but not all seem to work with modern-screenshot?
Here's an example I can't get to work:
HTML (in Vue 3):
JAVASCRIPT
What would the minimum code be for downloading a png of a div with a cors background image like that one above?
Thanks so much.