Search
fetch with Timeout
16.1.2023
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 available...
Java webové stránky s AJAX
8.3.2021
V době kolem covidového Silvestra roku 2020 jsem vytvořil prototyp jednoduché webové stránky s podporou AJAX s cílem eliminovat Java vývojáře od Javascriptu. Vývojář se však neobejde bez znalosti struktury HTML stránky ani bez znalosti CSS selektorů. Původní řešení jsem trochu zobecnil, vybrané...
WordPress-Powered Landing Pages on a Totally Different Site via Cloudflare Workers
22.7.2020
What if you have some content on one site and want to display that content on another site? We can do this in the browser no problem. We can fetch it, and plunk it onto the page.
Ajax, right? Ugh. Now we’re in client-side rendered site territory, which isn’t great for performance...
Stay DRY Using axios for API Requests
18.6.2020
HTTP requests are a crucial part of any web application that’s communicating with a back-end server. The front end needs some data, so it asks for it via a network HTTP request (or Ajax, as it tends to be called), and the server returns an answer. Almost every website these days does this in some...
Accessibility Links
2.4.2020
Austin Gil has kicked off the first in a five-part series about “HTML Forms Right” and to starts with semantics. It’s talking to the “we build our front-ends with JavaScript” crowd. The first block of code is an example of an Ajax form submission where the data...
How to Cancel a Fetch Request
17.3.2020
JavaScript promises have always been a major win for the language — they’ve led to a revolution of asynchronous coding that has vastly improved performance on the web. One shortcoming of native promises is that there’s no true way to cancel a fetch…until now. A...
Apollo GraphQL without JavaScript
29.1.2020
It's cool to see progressive enhancement being done even while using the fanciest of the fancy front-end technologies.
This is a button in a JSX React component that has a click handler applied directly to it that fires a data mutation Ajax request through Apollo GraphQL. That is about the least...
How to Detect an Ad Blocker
8.10.2019
One of the unspoken rules of the internet is that most content is “free”… at the cost of webpage being littered with advertisements and trackers. This was’t a big problem in the early internet days but trackers and advertisements have become so intrusive and unapologetically...
Other Ways to SPAs
21.8.2019
That rhymed lolz.
I mentioned on a podcast the other day that I sorta think WordPress should ship with Turbolinks. It's a rather simple premise:
Build a server-rendered site.
Turbolinks intercepts clicks on same-origin links.
It uses AJAX for the HTML of the new page and replaces the current page...