Search
Be Prepared for Failure and Handle it Gracefully
20.12.2021
When I was working at my first “real” job in the field in the mid-2000s, it was hammered in the web dev field to build tiny websites (no more than 100KB per page), only use JavaScript for special effects, and …
navigator.clipboard API
13.12.2021
Reading from and writing to the user’s clipboard can be both a very useful and dangerous capability. Used correctly and it’s a huge convenience to the user; used dubiously and the user could suffer catastrophic consequences. Imagine a wrong account number or wallet address being copied...
Eye Droppin’
9.12.2021
Quick hits! There is a new web API called EyeDropper:
if ('EyeDropper' in window) {
const eyeDropper = new EyeDropper();
try {
// This has gotta be triggered by a user interaction,
// so consider this pseudo-code.
const result …
The Invisible JavaScript Backdoor
8.12.2021
An interesting (scary) trick of an nearly undetectable exploit. Wolfgang Ettlinger:
What if a backdoor literally cannot be seen and thus evades detection even from thorough code reviews?
I’ll post the screenshot of the exploit from the post with the …
The Many Faces of VS Code in the Browser
18.11.2021
VS Code is built from web technologies (HTML, CSS, and JavaScript), but dare I say today it’s mostly used a local app that’s installed on your machine. That’s starting to shift, though, as there has been an absolute explosion of …
The post The Many Faces of VS Code in...
Array.prototype.at
8.11.2021
Working with arrays is an essential skill in any programming language, especially JavaScript, as we continue to rely on external data APIs. JavaScript has added methods like find and `findIndex recently, but one syntax I love from languages like Python is retrieving values by negative indexes. When...
Proxying Third-Party JavaScript as First-Party JavaScript (and the Potential Effect on Analytics)
2.11.2021
First, check out how incredibly easy it is to write a Cloudflare Worker to proxy another URL:
addEventListener("fetch", (event) ={
event.respondWith(
fetch("https://css-tricks.com")
);
});
It doesn’t have any error handling or anything, but hey, it works:
Now imagine how …
The...
Responsible JavaScript
2.11.2021
High five to Jeremy on the big release of Responsible JavaScript on A Book Apart. There is a lot of talk about how the proliferation of JavaScript has had a negative impact on the web, but now we have …
The post Responsible JavaScript appeared first on CSS-Tricks. You can support CSS-Tricks...
In-Page Filtered Search With Vanilla JavaScript
26.10.2021
If you have a page that includes a lot of information, it’s a good idea to let users search for what they might be looking for. I’m not talking about searching a database or even searching JSON data — I’m …
The post In-Page Filtered Search With Vanilla JavaScript appeared first...
Command Line trash
24.10.2021
One of the first commands you learn when experimenting with command line is rm, the utility for deleting files and directories. Deletion is a core computer UI operation but operating systems use a “Trash” paradigm, where files are stored before truly deleted. With the rm utility...
WooCommerce + Google Analytics
12.10.2021
Google Analytics is powerful analytics software. A common way to use it is to just slap the JavaScript snippet on every page template you have and let it collect basic data about unique visitors and pageviews and such. That’s useful, …
The post WooCommerce + Google Analytics appeared...
Jekyll doesn’t do components? Liar!
8.10.2021
I like the pushback from Katie Kodes here. I’ve said in the past that I don’t think server-side languages haven’t quite nailed “building in components” as well as JavaScript has, but hey, this is a good point:
1. Any basic
…
The post Jekyll doesn’t...
Scroll Shadows With JavaScript
6.10.2021
Scroll shadows are when you can see a little inset shadow on elements if (and only if) you can scroll in that direction. It’s just good UX. You can actually pull it off in CSS, which I think is …
The post Scroll Shadows With JavaScript appeared first on CSS-Tricks. You can support...
Links on React and JavaScript II
1.10.2021
How To Use The Vite Build Tool with React — Vite is hot, in part, because it’s based on esbuild and wickedly fast. It’s from Evan You of Vue fame, but it’s not a Vue-specific tool. Here, NARUHODO covers how
…
The post Links on React and JavaScript II appeared first...
How to Create a UUID in JavaScript
30.9.2021
The UUID identifier has been used in programming since the days a baby-faced David Walsh became a professional software engineer. My first exposure to UUIDs was via a ColdFusion app I inherited and … the less we say about that the better. In any event, I was recently surprised to see that...
Comparing Methods for Appending and Inserting With JavaScript
24.9.2021
Let’s say we want to add something to a webpage after the initial load. JavaScript gives us a variety of tools. Perhaps you’ve used some of them, like append, appendChild, insertAdjacentHTML, or innerHTML.
The difficult thing …
The post Comparing Methods for Appending...
imba
20.9.2021
It’s not every day you see a new processor for building websites that reinvents the syntax for HTML and CSS and JavaScript. That’s what imba is doing.
That’s an awful lot of vendor lock-in, but I guess if you get …
The post imba appeared first on CSS-Tricks. You can support...
AggregateError
17.9.2021
One of the big themes of the web these days is concurrency, which leads to accomplishing tasks asynchronously. In doing so, the possibility of multiple errors can occur. Instead of providing a generic error, optimally you’d provide a wealth of error information. TheAggregateError error lets...
An Intro to JavaScript Proxy
15.9.2021
Have you ever been in a situation where you wish you could have some control over the values in an object or array? Maybe you wanted to prevent certain types of data or even validate the data before storing it …
The post An Intro to JavaScript Proxy appeared first on CSS-Tricks. You...
AWS Lambdas: Easy, Easier, Easiest
4.9.2021
I’d say cloud functions are one of the most transformative technologies in the last bunch of years. They are (usually) cheap, scale well, secure in their inherit isolation, and often written in JavaScript—comfortable territory for front-end developers. Nearly every cloud …
The post...