Share links without tracking with a minimal PWA

It is no secret that I am very concious about privacy and try to avoid the new world of data hoarding that we live in as much as possible. However, I also want to share some stuff I find interesting with others every now and then.

Every time I would do that in the past, I would mindlessly send them a link with many UTM query parameters that would tell them everthing about where I was consuming this content, or whatever the content creator or platform decided it needed to know about me.

At some point I got annoyed and decided that I'd code an application that would clean those links before sharing them.

First prototype

Back then, I used to have an Android phone and I knew my way around Android apps at a newbie level. I managed to build something that I thought offered the least friction possible for the user (me) and was the closest to achieving my goal: sharing content without tracking parameters.

Let's imagine for a second a scenario where I am reading this article and I want to share it with my friend. My Android app would be a "share target", that is, instead of sharing directly the link of the page to my friend in the messaging app, I would instead share it to MY app.

The app would show me a preview of the link, with all parameters stripped, and instantly trigger again a "sharing intent" which is the sharing dialog where you choose who to share it with. Then, I could send the clean link to the person I wanted to in the first place.

Move to iOS

That app was working perfectly for my needs. However, at some point I decided I wanted to change platforms and start using iOS.

As of today, I am not sure the same kind of interaction is possible in iOS. If you are an iOS developer, or just simply happen to know how to reproduce the behaviour of my Android app on iOS, please hit me up on Twitter :)!

So after failing at trying to code the same app for iOS, I took a step back. What is the best I can make with the tools that I have? Well, for one I'm a web developer, and PWAs should be good enough by now... but I would lie if I said the ghost of Safari Mobile wasn't haunting me a bit.

Maybe it would be enough to make a very simple PWA that didn't need any of the more advanced features PWAs can provide?

The return of the website

The answer was: yes.

Furthermore, the answer was: you don't even need a PWA.

By now, Safari Mobile supports "Add to home screen" which with a bit of Web Manifest magic can give a website a decent icon and fullscreen app-like appearance. Android (via Chrome but also Firefox and others) also supports saving to home screen and much more, but it's probably called differently in each browser.

I guess it's important to mention that this website version introduces more friction than the streamlined Android app. That is because my website cannot be registered as a "share target"*. You have to manually copy the link and then input it in the website. However, the website uses the Share API, so you can at least have the second sharing part of the flow automated.

On the bright side, in the end I didn't even need all the machinery of service workers, which was perfect for another goal I did not mention yet.

Open and transparent

I wanted this website to be simple. So simple that anyone could run it themselves, and as transparent that anyone could check what it was exactly doing so that they could trust it.

After all, this "app" would be able to see a lot of links that you consumed or wanted to share. I wouldn't have trusted an app from any store, be it iOS or Android. I know app developers in general are not evil, but sometimes the libraries they use are.

I don't plan on adding anything to the website. It is by design that it does only one thing. No extra markup, no extra Javascript.

But since I am making this code public via its repository in Github, anyone is free to go grab it and make whatever changes they consider appropriate to run their personalized version :)

Final thoughts

Thanks for reading if you made it this far! You can find the code of the website in the Github repository.

This is probably a lot of effort for most people just to avoid some query parameters. I am fully aware of this, and I am just sharing this so that if some other soul like me is feeling the same way, they can benefit from this themselves :)

Even if you don't care about this use case in particular, maybe reading this post sparks in you the idea of building some very simple website that fulfills a need you find in your everyday life.

I also wanted to mention I will eventually share the code of my Android app, once I find the code itself and make it a bit decent to be online :P

And I guess it's also fair to point out I lied in the title of this blogpost since my website doesn't fully qualify as a PWA according to MDN's What makes an app a PWA?, but it was just for the sake of being concise!

I will try to continue sharing the little tools I build along the way and hopefully help someone else. And if you want to reach me, you know where to find me on Twitter!

* You can find more about the Web Share Target API spec draft which will eventually bring these capabilities to any browser.