Menu

Colin Devroe

Reverse Engineer. Blogger.

Like? Subscribe.

Testing inconsistent Web Share Target API data with a Progressive Web App

March 4, 2019

One of the latest things I’ve been working on for Unmark is turning the app into a Progressive Web App (PWA). Among other benefits, this affords Unmark the capability of being a “Web Share Target” on Android. (Sadly, only Android for now)

A Web Share Target is very similar to a feature you likely use every day and may not realize it. When you “Share to” or “Share via” an app (say, Twitter or Facebook or Micro.blog’s iOS app) it automatically picks up the URL, title, etc. from the web page you’re currently on – this is using a similar feature set. For PWA’s, this is called the Web Share Target API.

What happens is that the app you share from sends a small little packet of data to the app or PWA. According to the spec it should be sending three specific items: title, url, and notes.

The issue I’ve been working through is that each app has a different way of sending that data. Some of them exclude one or more of the items and each of them have very different ways of sending “Notes”.

I don’t know why these apps aren’t consistent. I suppose it might be in part because they are handling PWAs the same way they are handling other apps. They are just sending a “chunk” of data and they expect the target app to work through it all.

Today I was noodling how best to set up a test application to install on my Android phone so that I can inspect how these apps share their information. This way I can see exactly what information is being shared how Unmark could work with each of them. And I was going to open source it so that others working on this same issue had something they could use.

But it turns out I don’t need to, the Web Incubator Community Group already has a Web Share Target Test PWA already in place to do this. Just install this app on your Android device’s home screen and “Share To” it.

Thanks to Matt Giuca on the Google Chrome team for pointing me in the right direction. I’m glad this already existed.

Leave a Reply