JavaScript Dom question

Hello, I am wondering if there is a way to select the entire viewport using JavaScript.

The end goal is to create a button that will take a screenshot of the entire screen so that users can send the screenshot in an email.

Thank you in advance for the help!

Firefox does (kind of) this by hitting CTRL + SHIFT + S.
But it’s not that reliable all the time.

What happens when you use a search engine and try some stuff?
E.g. https://stackoverflow.com/questions/5621907/how-to-screenshot-website-in-javascript-client-side-how-google-did-it-no-nee