How to Fix: Windows WASD Keys Reversed with Arrow Keys

This past weekend I had the opportunity to be what every father wants, if only for a moment: the “cool dad”. My wife was out of town and my youngest son wanted to play PUBG. I caved in, taught him the basic FPS key binds, and he was having a great time. While he was […] The post … | Continue reading


@davidwalsh.name | 7 days ago

HTML popover Attribute

Modals have been an important part of websites for two decades. Stacking contents and using fetch to accomplish tasks are a great way to improve UX on both desktop and mobile. Unfortunately most developers don’t know that the HTML and JavaScript specs have implemented a native mo … | Continue reading


@davidwalsh.name | 23 days ago

Get Started in AI and NFTs with the Limewire API (Sponsored)

AI media creation has expanded to incredible video art and a host of other important improvements, and LimeWire is leading the way in creating an awesome interface for the average user to become an AI artist. Limewire has just released its Developer API, a method for engineers li … | Continue reading


@davidwalsh.name | 1 month ago

I’m So Old: Web Edition

Time can be a funny thing. I still remember discovering HTML, CSS, and JavaScript coding. I still remember my first college programming course. I still remember my first day at my first coding job, then my first day at my second coding job, and then my first day at Mozilla. I sti … | Continue reading


@davidwalsh.name | 1 month ago

Detect Caps Lock with JavaScript

Anyone is capable of having their caps lock key on at any given time without realizing so. Users can easily spot unwanted caps lock when typing in most inputs, but when using a password input, the problem isn’t so obvious. That leads to the user’s password being incorrect, which … | Continue reading


@davidwalsh.name | 3 months ago

How to Override width and height HTML attributes with CSS

One of the HTML elements that frequently comes into collision with CSS is the img element. As we learned in Request Metrics’ Fixing Cumulative Layout Shift Problems on DavidWalshBlog article, providing image dimensions within the image tag will help to improve your website’s scor … | Continue reading


@davidwalsh.name | 3 months ago

Fixing Cumulative Layout Shift Problems on DavidWalshBlog

Over 50 thousand developers visit DavidWalshBlog every month from around the world to learn JavaScript tricks and fix problems in their code. Unfortunately, some of them have a slow experience on the site. David tracks the performance of his Core Web Vitals and overall performanc … | Continue reading


@davidwalsh.name | 3 months ago

Date.now()

Ask any software engineer and they’ll tell you that coding date logic can be a nightmare. Developers need to consider timezones, weird date defaults, and platform-specific date formats. The easiest way to work with dates is to reduce the date to the most simple format possible — … | Continue reading


@davidwalsh.name | 3 months ago

Extract a Number from a String with JavaScript

User input from HTML form fields is generally provided to JavaScript as a string. We’ve lived with that fact for decades but sometimes developers need to extract numbers from that string. There are multiple ways to get those numbers but let’s rely on regular expressions to extrac … | Continue reading


@davidwalsh.name | 3 months ago

Thoughts on Streaming Services: 2024 Edition

Streaming services have revolutionized content delivery, sending linear media companies into a panic as they watch traditional cable services decay. “Cutting the cord” is a common practice these days, but the streaming landscape isn’t perfect. We’re a decade into streaming so I w … | Continue reading


@davidwalsh.name | 3 months ago

AutoGrow Textareas with CSS

As the demands of the web change and developers experiment with different user experiences, the need for more native language improvements expands. Our presentation layer, CSS, has done incredibly well in improving capabilities, even if sometimes too slow. The need for native sup … | Continue reading


@davidwalsh.name | 4 months ago

How to Play Grand Poo World 3

The underground world of creating and streaming Super Mario World-based ROM hacks continues to gain popularity. This popularity is a tribute to the creativity of gamers and the quality of the original 30 year old video game’s mechanics. Over the past decade, incredible ROM hacks … | Continue reading


@davidwalsh.name | 5 months ago

How to Get the Current Branch Name with git

Most developers spoil themselves with fun command line utilities to make their work easier and more efficient. One such command line helper allows developers to always show the git branch in the command line. How can you get the current branch? With this handy snippet: git branch … | Continue reading


@davidwalsh.name | 6 months ago

AutoSave with VSCode

Visual Studio Code has taken the crown of most used text editor, at least in JavaScript spheres. VSCode is fast, feature-filled, and supports thousands of plugins to boost productivity. Developers can also tweak hundreds of settings to enrich functionality. One such feature is th … | Continue reading


@davidwalsh.name | 6 months ago

How to Detect Failed Requests via Web Extensions

One of the best things that ever happened to t he user experience of the web has been web extensions. Browsers are powerful but extensions bring a new level of functionality. Whether it’s crypto wallets, media players, or other popular plugins, web extensions have become essentia … | Continue reading


@davidwalsh.name | 7 months ago

Welcome to the New LimeWire: AI Media Generation (Sponsored)

LimeWire was a staple of my youth. LimeWire was software that allowed users to share any type of file during the revolutionary days of file sharing. Fast forward to today and LimeWire is back, again as revolutionary software, but this time in the field of AI content publishing. F … | Continue reading


@davidwalsh.name | 7 months ago

Unveiling 15+ Essential Tools & Resources for Web Designers and Agencies in 2023 (Sponsored)

You’ve visited countless websites, and now you’re designing your own. Stop and think for a minute about what you’ve liked and didn’t like about some of those you visited. Was it the front page, the layout in general, or the functionalities that either met with your satisfaction o … | Continue reading


@davidwalsh.name | 7 months ago

Unveiling 15+ Essential Tools & Resources for Web Designers and Agencies in 2023 (Sponsored)

You’ve visited countless websites, and now you’re designing your own. Stop and think for a minute about what you’ve liked and didn’t like about some of those you visited. Was it the front page, the layout in general, or the functionalities that either met with your satisfaction o … | Continue reading


@davidwalsh.name | 7 months ago

Sum an Array of Numbers with JavaScript

It’s rare that I’m disappointed by the JavaScript language not having a function that I need. One such case was summing an array of numbers — I was expecting Math.sum or a likewise, baked in API. Fear not — summing an array of numbers is easy using Array.prototype.reduce! const n … | Continue reading


@davidwalsh.name | 8 months ago

JavaScript waitFor Polling

As more of the JavaScript developers write becomes asynchronous, it’s only natural to need to wait for conditions to be met. This is especially true in a world with asynchronous testing of conditions which don’t provide an explicit await. I’ve written about waitForever, waitForTi … | Continue reading


@davidwalsh.name | 8 months ago

queryLocalFonts

One of the larger downloads when requesting a webpage are custom fonts. There are many great techniques for lazy loading fonts to improve performance for those on poor connections. By getting insight into what fonts the user has available, we can avoid loading custom fonts. That’ … | Continue reading


@davidwalsh.name | 9 months ago

Use XHR/fetch Breakpoints!

Web debugging tools are so incredibly excellent these days. I remember the days where they didn’t exist and debugging was a total nightmare, even for the simplest of problems. A while back I introduced many of you to Logpoints, a way to output console.log messages without needing … | Continue reading


@davidwalsh.name | 9 months ago

URL.canParse

Parsing of URLs on the client side has been a common practice for two decades. The early days included using illegible regular expressions but the JavaScript specification eventually evolved into a new URL method of parsing URLs. While URL is incredibly useful when a valid URL is … | Continue reading


@davidwalsh.name | 9 months ago

JavaScript closest

When it comes to finding relationships between elements, we traditionally think of a top-down approach. We can thank CSS and querySelector/querySelectorAll for that relationship in selectors. What if we want to find an element’s parent based on selector? To look up the element tr … | Continue reading


@davidwalsh.name | 10 months ago

ChatGPT via WYSIWYG (Sponsored)

Artificial intelligence applications have hit like a massive wave over this past year, with ChatGPT being the most prominent. ChatGPT can take any written command and suggest content to match. What better than having the power of AI content creation than doing so within your own … | Continue reading


@davidwalsh.name | 10 months ago

JavaScript: Reverse Arrays

Manipulating data is core to any programming language. JavaScript is no exception, especially as JSON has token over as a prime data delivery format. One such data manipulation is reversing arrays. You may want to reverse an array to show most recent transactions, or simple alpha … | Continue reading


@davidwalsh.name | 10 months ago

Confessions of a Web Developer XX

It’s been quite a while since I’ve gotten a few things off of my chest and since I’m always full of peeves and annoyances I thought it was time to unleash: One day you’re getting recruited by another crypto wallet vendor, the next their users are getting drained of funds. Dodged … | Continue reading


@davidwalsh.name | 11 months ago

How to Create a Screen Recording with Quicktime

Creating screen recordings is an essential skill for web developers. Screen recordings can illustrate new features, bugs, or a variety of other ideas. I’m often asked what app I use to create screen recordings and people are shocked when I tell them Quicktime! Let’s review how to … | Continue reading


@davidwalsh.name | 11 months ago

Restart Mac From Command Line

Restarting and shutting down a computer remotely is a frequent task for remote system administrators. As someone that writes many shell scripts, I also find myself automating system restarts. Let’s look at a few ways to restart Mac systems from command line! Restart a Local Mac T … | Continue reading


@davidwalsh.name | 1 year ago

How to Use Your Domain on Bluesky

Bluesky is a hot new social networking platform that functions like Twitter from Twitter’s original founder. New users are flooding into the platform as a respite from Elon Musk’s vision of Twitter and the fumbles that have happened since his takeover. Upon signing up for Bluesky … | Continue reading


@davidwalsh.name | 1 year ago

10 Great Multipurpose WordPress Themes (Sponsored)

Multipurpose themes are flexible WordPress templates that can be used to create virtually any kind of website. They are often best-sellers, and because they are so popular there are a lot of them to choose from. Too many in fact unless you have time to spare to find one that is b … | Continue reading


@davidwalsh.name | 1 year ago

How to Blur Faces in a Video from Command Line

Privacy is always incredibly important, especially with visual media where you may not have the permission of individuals in the video. If you’re filming something in public, it’s likely you’ll catch someone’s face who simply doesn’t want or need to be identified. This recently g … | Continue reading


@davidwalsh.name | 1 year ago

CSS content-visibility

The CSS language is full of small gaps which are frustrating to navigate. Between CSS properties to hide a container and its contents, there is still room for improvement. visibility: hidden keeps height and width integrity while display: none on a container hides everything. You … | Continue reading


@davidwalsh.name | 1 year ago

How to Get a Computer’s Hardware ID

Cheating in online games is a huge issue these days — just ask anyone playing PUBG. Cheaters aren’t difficult for players to spot but vendors oftentimes don’t do enough to punish these villains. Krafton recently announced they would start banning cheaters by hardware ID, which go … | Continue reading


@davidwalsh.name | 1 year ago

JavaScript Array Group

Managing, sorting, and manipulating data with JavaScript is a skill we’ve often delegated to third party libraries like lodash. As the JavaScript language progresses, however, these features eventually get. added to the JavaScript specification. Two such APIs for grouping of Arra … | Continue reading


@davidwalsh.name | 1 year ago

How to Get a Base64 Version of a File From Command Line

A while back I wrote an article on how to Convert Image to Data URI with JavaScript. It’s a neat trick developers can use for any number of reasons. Instead of abusing canvas, however, why not simply get the base64 data from command line? You can use base64 and pbcopy to convert … | Continue reading


@davidwalsh.name | 1 year ago

How to Get Mac Battery Level from Command Line

I’m a big fan of having as much information as I can get within the command line. I couldn’t go without knowing which git branch I’m on, for example. Another important piece of information I like having is my current battery percentage. To get the current battery level from comma … | Continue reading


@davidwalsh.name | 1 year ago

How to Block a Range of IP Addresses

As much as content creators want traffic to their website, there is such thing as the wrong type of traffic. Sometimes it’s content scrapers, sometimes it’s malicious bots; either way, it’s important to know how to block problematic IPs from your site. To block a range of IP addr … | Continue reading


@davidwalsh.name | 1 year ago

Detect the Content Type in the Clipboard

A user’s clipboard is a “catch all” between the operating system and the apps employed on it. When you use a web browser, you can highlight text or right-click an image and select “Copy Image”. That made me think about how developers can detect what is in the clipboard. You can r … | Continue reading


@davidwalsh.name | 1 year ago

CSS ::file-selector-button

We all love beautifully styled form controls but, due to the differences between operating system displays, styling them can be painful. Due to that pain, we’ve created scores of libraries to mock these controls. Unfortunately that sometimes comes at the cost of accessibility, pe … | Continue reading


@davidwalsh.name | 1 year ago

How to Open a Tor Brave Window from Command Line

I love the Brave web browser for many reasons: ad blocking, Brave rewards, crypto integration, and even a Tor tab feature. I’ll often use the Tor feature but wanted to know how I could automated opening Tor windows from command line. To open a Brave Tor tab, you can use the follo … | Continue reading


@davidwalsh.name | 1 year ago

How to Open an App from Anywhere on Mac Command Line

Many engineers like myself live in the command line, and perform actions from command line that most others would click an icon for. I’ve always found opening apps from command line on Macs painful. You need to references the Applications directory, add .app to the name, etc. I j … | Continue reading


@davidwalsh.name | 1 year ago

How to Create a Diff of Two Images

When I was a child, I loved looking for Waldo in the “Where’s Waldo?” book series. These days I’m a sucker for TMZ’s “What’s the Big Frigin Difference” images, where TMZ slightly changes an image and you have to spot the differences between the two. That got me to thinking — how … | Continue reading


@davidwalsh.name | 1 year ago

5 Web Design Trends for 2023 That You Should Pay Attention To (Sponsored)

The start of a new year is usually a time when we start looking for ways to make something a little better. That something could be our life, work, or what we produce. Web designers, for example, might look for ways to make their designs more interesting or effective. In this pos … | Continue reading


@davidwalsh.name | 1 year ago

fetch with Timeout

A few years back I wrote a blog post about how write a fetch Promise that times out. The function was effective but the code wasn’t great, mostly because AbortController , which allows you to cancel a fetch Promise, did not yet exist. With AbortController and AbortSignal availabl … | Continue reading


@davidwalsh.name | 1 year ago

Customizing HTML Form Validation

Form validation has always been my least favorite part of web development. You need to duplicate validation on both client and server sides, handle loads of events, and worry about form element styling. To aid form validation, the HTML spec added some new form attributes like req … | Continue reading


@davidwalsh.name | 1 year ago

How to Determine a JavaScript Promise’s Status

Promises have changed the landscape of JavaScript. Many old APIs have been reincarnated to use Promises (XHR to fetch, Battery API), while new APIs trend toward Promises. Developers can use async/await to handle promises, or then/catch/finally with callbacks, but what Promises do … | Continue reading


@davidwalsh.name | 1 year ago

Detect XR Support with JavaScript

A few years ago I wrote an article about how to detect VR support with JavaScript. Since that time, a whole lot has changed. “Augmented reality” became a thing and terminology has moved to “XR”, instead of VR or AR. As such, the API has needed to evolve. The presence of navigator … | Continue reading


@davidwalsh.name | 1 year ago