3 ms·
You can screenshot DOM structures natively by including them in an SVG <foreignObject>, composing an SVG blob URL, rendering it in an <img> tag, and then drawin
by Sephr 7y ago
You can screenshot DOM structures natively by including them in an SVG <foreignObject>, composing an SVG blob URL, rendering it in an <img> tag, and then drawing that to a <canvas>.
I started a project related to this years ago but never finished it. Now that same-origin canvas taint issues have been fixed in most browsers, maybe it's time for me to work on this again.
A related API that is not accessible to web content is Safari's console.screenshot() utility[1].
[1]: https://twitter.com/webkit/status/1222236427326373888 https://twitter.com/webkit/status/1222236427326373888