If I share a picture from Google Photos to my PWA (installed with Chrome on Android and using this code https://web.dev/web-share-target/), I arrive on my PWA page. How to go back automatically to Google Photo?
Backend is in PHP if that matters.
Thanks!
Asked
Active
Viewed 377 times
1

Cantuariensis
- 25
- 2
1 Answers
1
I haven't tested this, but have you tried redirecting from your service worker's fetch
event handler to an HTML page that immediately uses this technique to close itself?
Something like:
self.addEventListener('fetch', (event) => {
// ...process the incoming event.request body here...
// Once you're done, respond with a redirect:
event.respondWith(Response.redirect('/self-closing-page.html', 303));
});
And then your /self-closing-page.html
web page would just close itself. That would (maybe?) leave you back in the original Android app.

Jeff Posnick
- 53,580
- 14
- 141
- 167
-
Holy Moly, I didn't expected this one to work. Thanks so much! To recap for other people, I output `echo "PWA redirect...";` when my PHP page finished receiving the data. This close the webpage and go back to the previous screen (Google Photo in my example) almost instantly. – Cantuariensis May 18 '20 at 12:57