Added B4.0013 Post
All checks were successful
/ weblog.lol (push) Successful in 14s

This commit is contained in:
Gordon Pedersen 2024-09-03 11:48:15 +10:00
parent 7ed27044cc
commit 25af7ac1ee
2 changed files with 26 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
weblog/.obsidian

View file

@ -0,0 +1,25 @@
---
title: B4.0013 Going on Safari (Prologue)
date: 2024-09-03
location: /B4.0013
tags: Blog, Markdownload, Development
---
# Going on Safari (Prologue)
I'm currently working on a complete rewrite of my browser extension, MarkDownload. In the current version, most of my logic and processing takes place on a persistent background page. An invisible webpage, just sitting there taking up memory, waiting for someone to click that button and get the process started.
Google Chrome decided to change all that, and get rid of background pages in favour of service workers, which — long story short — *don't* persist in the background. They wake up when given certain signals then disappear again. It's certainly not a worse way of doing things, but it's very different to what's working now, so it's a good time to re-think and re-write the entire extension.
One thing that's kind of annoying about the current version is the ephemeral nature of the popup. If you clip a page, make some modifications and then accidentally click off the popup, it's all gone and you have to start over again. Well, Chrome (and most chromium-derived browsers) has a side panel now, and Firefox already had a sidebar, so now seems like a good time to take advantage of all that. There's just one major problem with all this: Safari does not have a sidebar of any sort.
Something else that's at the back of my mind is the image downloading, and especially how it doesn't really work well on Safari browsers. These things are important, because the Safari version of the extension is the only one I charge for (I have to pay for my Apple developer license somehow), but it currently has a worse experience than the free versions.
Due to the way Apple goes about Safari extensions, there is a MacOS app attached to it. The current version of the app is just the templated default from Apple. It's useless. It just pops up a window to tell you the extension is installed and there's a button to quit the app and open Safari's extension options. I've had the idea for a long time that I should be able to fix image downloading on Safari by having that MacOS app somehow handle the image downloads. And also, Safari does not have a sidebar, but I could run that in the native app and have it communicate with the extension — that is the point of having an app attached to an extension, after all.
I started writing this blog post as a way to explain the technical stuff I've learned so far, because the process for getting data between the extension and the app was (and is) not obvious or easy. I have a prototype solution at the moment involving native messaging, webkit message handlers, User Defaults and custom protocol handlers. It's convoluted. But I've waffled on enough about the reasoning that I think this should become a multi-part blog post with the technical stuff separate.
Also, I spy another rabbit hole over there to do with native messaging... If I can elevate the experience for Safari with a native app, could I do the same for other browsers and platforms? Could I offer a paid-for version of a desktop app that enhances the extension's functionality with previously impossible features? Like, at least, the ability to save clipped websites and images *outside* the download folder (the single most-requested and most impossible feature)?
We shall see. For now, I'm going to do a little more research and tinkering while I write up a more technical blog post on how to achieve what I want. See you then.