Javascript

Take Screenshots With Javascript (Simple Examples)

Welcome to a tutorial and examples on how to take screenshots with Javascript. So you have a project that needs to do screenshots? An easy way to capture screenshots in Javascript is to use the html2canvas library: html2canvas(document.body).then(canvas => { let a = document.createElement(“a”); a.download = “ss.png”; a.href = canvas.toDataURL(“image/png”); a.click(); }); That’s all for

Take Screenshots With Javascript (Simple Examples) Read More »

Simple Textarea With Remaining Characters Counter (Free Download)

Welcome to a tutorial on how to create a text area with a remaining character counter in Javascript. Limiting the number of characters in a text field is as easy as setting the maxlength, but how do we add a “countdown” to it? <textarea id=”demoA” maxlength=”160″></textarea> <div id=”demoB”>160</div> <script> var a = document.getElementById(“demoA”), b =

Simple Textarea With Remaining Characters Counter (Free Download) Read More »

Javascript Image To Text With OCR (Simple Examples)

Welcome to a tutorial on how to convert an image to text in Javascript. Yes, image-to-text has already been around for some time, and it is called “Optical Character Recognition” (OCR). There is an open-source OCR library called TesseractJS that we can use: async conv () { const worker = await Tesseract.createWorker(); await worker.loadLanguage(“eng”); await

Javascript Image To Text With OCR (Simple Examples) Read More »

Capture Photos With Webcam In Javascript (Simple Example)

Welcome to a tutorial on how to capture photos with a webcam in Javascript. Yes, the Stone Age of the Internet is long over, and it is totally possible to take pictures directly using Javascript. navigator.mediaDevices.getUserMedia({ video: true }).then(stream => { // WEBCAM STREAM TO VIDEO let v = document.createElement(“video”); v.autoplay = true; v.srcObject =

Capture Photos With Webcam In Javascript (Simple Example) Read More »