Project 25, PWA and offline
Share Target Link Saver
Install it on your phone, then pick it from the share menu in any app. Links land in this reading list, and you can share them back out with one tap.
- Main API
- Web Share, Share Target
- Saves to
- localStorage
- Files
- index.html, sw.js, manifest
- Your browser
- Checking
Save a link
To test the real share sheet: open this page on Android, install it from the browser menu, then share a link from any app and choose Link Saver.
Reading list
How it works
- Register as a targetThe manifest declares share_target with an action URL and the names of the title, text and url parameters.
- Receive a shareWhen you share to the app, the OS opens index.html?title=...&text=...&url=... and the page saves it.
- Share back outnavigator.share() opens the native share sheet with a saved link, or with a file when canShare allows it.
// manifest.webmanifest
"share_target": {
"action": "./index.html",
"method": "GET",
"params": { "title": "title", "text": "text", "url": "url" }
}
// index.html: read what was shared
const p = new URLSearchParams(location.search);
if (p.has("url") || p.has("text")) saveLink(p.get("title"), p.get("url") || p.get("text"));
// Share back out
await navigator.share({ title: link.title, url: link.url });