Webventures

To boldy go where countless others have gone before.

Web Push on iOS - 1 year anniversary

TL;DR: Web Push on iOS is nearing its one year anniversary. It's still mostly useless. Updated Jan 30, 2024: Fixed some typos and such. Updated Jan 31, 2024: Added a "Further reading" chapter. Updated Feb 9, 2024: Minor edits to improve clarity, readability. It's been almost a year since I wrote about how iOS 16.4 beta was announced, ...

AIHTW: The useStyle hook

TL;DR: It's like clsx, but for `style` props. This is the first post in what I hope will become a series called "Am I holding this wrong?" The idea is to do a short post where I share something I've come up with, but where I'm not 100% convinced if I'm actually doing it right, if it makes sense and/or...

Web Push on iOS requires installing the web app

TL;DR: iOS' Web Push implementation kind of defeats a key point of the web. Yesterday, the WebKit team dropped some big news: iOS and iPad OS 16.4 beta 1 won't just bring support for Web Push, they will also add support for the Badging API and 3rd-party browsers will finally be allowed to add a website to the home screen! That...

Abortable promise chains

TL;DR: An idea for a small library that makes it easier to abort Promise chains. But... why? I've found myself wanting to be able to easily abort a Promise chain many times. And by that I don't mean just the initial promise itself (which is possible), I want the ability to abort anywhere in a Promise, even in the middle of the chain...

Stripping html - dos, don'ts and more

TL;DR: Use template (not div) and textContent (not innerText). Every so often I run into a situation where I need to strip HTML from a string. For example. this blog's post list includes a short excerpt of the actual post, but I didn't want any of the content's HTML in there, just the plain text. I recently revisited ...

In-App Browsers are tracking you(r users)

TL;DR: Users are being spied on, websites are broken and hijacked. Most people probably don't know this, but when you click a link in Facebook, Instagram, TikTok and many other apps, you're viewing the site (and all subsequent pages you visit from there) in a so-called In-App Browser (IAB). Felix Krause uncovered that t...

Need cheap paint? Use getComputedStyle().opacity

TL;DR: If you need a double rAF() for a transition to work, getComputedStyle().opacity may be a cheap, synchronous alternative. I thought I'd share a neat little trick I learned a few years back, just a nice and short blog post like I did a while ago. As it turned out, that little trick lives in the intricate world of the Browser rendering pipeline. I knew that, I just didn't p...

The Biggest Thing from WWDC 2022

TL;DR: No one is talking about Apple announcing it's _finally_ going to bring Web Push to Safari. Safari is getting Web Push! On iOS! If you ask me, the biggest thing to come out of WWDC 2022 was the announcement of Web Push for Safari. MacOS is going to get it first and iOS will receive it in a later iOS 16.x update, sometime in 2023. iOS. Is. Gett...

Returning a promise in new Promise() vs .then()

TL;DR: Returning a promise in `new Promise()` never resolves, but returning a promise in `.then()` does. Consider the example below: The constructor of Promise expects a function that only resolves when its resolve() callback is called. Having it both (callbacks and return) could cause issues: To keep the API predictable, it was decided that the function yo...