Last active
May 14, 2024 11:17
-
-
Save nchevobbe/caec501e1bc0f78bd6aad72f414ff1d2 to your computer and use it in GitHub Desktop.
Log a data URL containing a screenshot of the window
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let canvas = window.document.createElementNS("http://www.w3.org/1999/xhtml", "html:canvas"); | |
let context = canvas.getContext("2d"); | |
canvas.width = window.innerWidth; | |
canvas.height = window.innerHeight; | |
context.drawWindow(window, 0, 0, canvas.width, canvas.height, "white"); | |
console.log(` | |
๐ธ ๐ธ ๐ธ ๐ธ | |
${canvas.toDataURL()} | |
๐ธ ๐ธ ๐ธ ๐ธ | |
`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment