News for hackers. Stuff that matters.
Re:Show HN: Screenshots in Chrome, Globally Available by andrethegiant on Saturday March 14, 2020 @03:21AM (#22573746)
I'd love this to be native... something like $(0).screenshot() would produce a base64 string of the rendered element. Why doesn't this exist? Why do we need to rely on browser extensions? The closest JS-based equivalent I've found is html2canvas, which doesn't work as well as advertised.
Re:Show HN: Screenshots in Chrome, Globally Available by mindfulplay on Saturday March 14, 2020 @04:40AM (#22574000)
It's a security landmine. IFRAMES, mixed content, downloading / rendering behaviors are all sensitive and may contain private information known only to the browser/user and not the containing webpage.
Re:Show HN: Screenshots in Chrome, Globally Available by Sephr on Saturday March 14, 2020 @04:02AM (#22573875)
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

Re:Show HN: Screenshots in Chrome, Globally Available by aswan on Saturday March 14, 2020 @11:09AM (#22575817)