An interesting little "feature" I stumbled across: when the file input field of an HTML form is disabled right before a submission, that field will be empty. Some pseudo code which illustrates the setup: ... <script> function submitForm(){ var form = document.getElementById("form"); var file = document.getElementById("file"); file.disabled = true; form.submit(); } </script> <body> <form id="form"> … Continue reading Disabling file input field cancels upload
Category: web
Disable Firefox media auto play
Disabling audio and video auto play in Firefox over the settings page doesn't work reliably at the time of writing (v111). I found this setting to get the job done: type about:config in the address bar Find the setting media.autoplay.blocking_policy Set it to the value 2
Force-enabling Firefox’ reader view
TL;DR: Prepend "about:reader?url=" to any website URL to force reader view in Firefox I'm in love with Firefox' reader view. It not only removes ads, nag-screens, subscription prompts and other clutter from articles but it's typographical choices often are better than the (well-intended) choices of the author. I also value the consistent look and feel … Continue reading Force-enabling Firefox’ reader view
Error handling for failed network requests with service workers
Most service worker code samples show only the happy path where the fetched resource will eventually be available, eg: self.addEventListener('fetch', event => { // Skip cross-origin requests, like those for Google Analytics. if (event.request.url.startsWith(self.location.origin)) { event.respondWith( caches.match(event.request).then(cachedResponse => { if (cachedResponse) { return cachedResponse; } return caches.open(RUNTIME).then(cache => { return fetch(event.request).then(response => { // Put … Continue reading Error handling for failed network requests with service workers
Book of dark arts: selective disclosure with CSS
Show and hide pages and page elements with declarative CSS instead of imperative code


