Latest Javascript Tutorials and How-To's

javascript

Detect If Element Removed from DOM with Javascript

We can detect whether an element has been removed DOM using the MutationObserver object. This provides the ability to observe for changes being made to the DOM tree.
January 13, 2021
javascript

Detect If Element Added to DOM with Javascript

We can detect if an element has been added to DOM using a MutationObserver object. This provides the ability to observe for changes being made to the DOM tree.
January 11, 2021
javascript

Getting Camera Resolution with Javascript

There is no direct method to find out the maximum resolution supported by the camera. Instead we can specify the required width & height using the ideal property to find the closest possible resolution.
January 9, 2021
javascript

Record Video From Camera using Javascript

Videos can be recorded from the user camera using MediaDevices & MediaRecorder APIs.
January 7, 2021
javascript

Uploading Canvas Image to a Server

Canvas images can be uploaded to server-side as a data URL string, base64 string or as a file.
January 4, 2021
javascript

Capture Photo From Camera using Javascript

Photos can be captured from a camera using a combination of MediaDevices & Canvas Javascript APIs. Video frame of the camera stream can be captured as an image.
January 2, 2021
javascript

Replacing All String Instances With replaceAll()

All instances of a given string can be replaced by using the replaceAll() method. This method newly added to Javascript is now supported in all modern browsers.
December 26, 2020
javascript

Detecting First Contentful Paint (FCP) in Javascript

First contentful paint (FCP) marks the time when browser renders some content for the given document. FCP can be captured in native JavaScript using PerformanceObserver & Paint Timing API.
December 23, 2020
javascript

How usefulangle.com Improved Its Largest Contentful Paint (LCP)

This article describes how usefulangle.com improved the LCP web vital metric when there was a hero image in the page.
December 21, 2020
javascript

Detecting If Adblocker Extensions Are Blocking Ads

A possible way of detecting adblockers is to listen to the onerror event of the ad serving script element. If the script fails to load, probably it has been blocked by an adblocker.
December 20, 2020
javascript

Get Form Input Fields As Query String in Javascript

Input fields inside a form can be retrieved as a query string using FormData & URLSearchParams objects.
December 20, 2020
javascript

Dynamically Loading Multiple Scripts in Sequence

Multiple Javascript files can be loaded dynamically and executed in a given order by creating script element for each of them, and inserting them to the DOM in order of their intended execution.
December 18, 2020
javascript

Javascript Const Objects - Can They Be Changed ?

Properties and methods be changed for a const object. It just means that the variable identifier cannot be reassigned.
December 14, 2020
javascript

How to Remove Event Listeners in Javascript

Events can be removed in Javascript using the removeEventListener() method. However few other things need to be done in order to remove the event successfully
December 14, 2020
javascript

Add Event to Multiple Elements By Class in Javascript

Events can be added to multiple elements that are selected by class by looping through the list of elements and registering event for each element individually.
December 13, 2020
javascript

Chrome Extension - How to Scrape Data from a List of Pages

This tutorial explains how to create a Google Chrome extension that will navigate through a list of given URLs, and save data from each page to a file.
December 8, 2020
javascript

Creating One Time Executing Events in Javascript

One-time executing events can be created by setting the once option as parameter to addEventListener() method.
December 8, 2020
html

Open Links in a New Tab, Or Re-Use Already Existing Tab

To ensure only a single new tab or window is created for several links in the page, the same child attribute needs to set for all the links.
November 27, 2020
javascript

Measuring Site Analytics with Javascript - Page Views & Bounce Rate

This tutorial explains how to measure site analytics (page views & bounce rate) using custom Javascript, rather than using third party analytics libraries.
September 28, 2020
javascript

Measuring Site Analytics with Javascript - Sessions

This tutorial explains how to measure site analytics (sessions) using Javascript, rather than using third party analytics libraries.
September 15, 2020