Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to install a Progressive Web App within an iframe?

I have a website. Let's call it www.example.com.

I load an iframe in www.example.com which is a PWA.

Is it possible to install the PWA in the iframe? If not, why?

like image 779
James Barrett Avatar asked Apr 30 '19 14:04

James Barrett


People also ask

How to install progressive web apps on iPhone?

How to install Progressive Web Apps on iPhone. 1 1) Tap the Share button in Safari for the PWA you’re using. 2 2) Tap the icon labeled Add to Home Screen. 3 3) Tap Add in the upper-right corner. 4 4) Now name your PWA so that it’s distinguishable from its native counterpart on the Home screen and in Search, then tap Add in the upper-right corner.

What are progressive web apps (PWA)?

Thanks to modern web technologies like HTML5, Progressive Web Apps run in a browser, don’t require separate distribution, combine features of native apps with the benefits of a mobile experience and let you keep them on the Home screen without the hassle of an app store.

What are PWAs on iOS and how do they work?

PWAs on the iOS platform require HTML5 features like the Web App Manifest specification and Service Workers so that they can use crucial background scripts. Mobile web developer Maximiliano Firtman has a detailed overview of PWAs and their support in Safari across Apple’s platforms, if you’re interested.

What's the difference between native and PWA apps?

Since PWAs live on the web, they take up far less room on your device than installed native apps. And, while many PWAs store information for offline access, they're still far less space-intensive than comparable native apps. For example, Starbucks offers a PWA that's over 99% smaller than its native iOS app.


1 Answers

It's not clear what you mean by "install".

If you're asking whether an <iframe> can register a service worker, the answer is yes. That service worker will have its install/activate handlers fired in the same manner as it would as if it were a top-level document that registered the <iframe>. Just to be clear, the service worker and cache storage will be scoped to the origin of the <iframe>, not the top-level document.

If you're talking about whether loading a document in an <iframe> can meet the requirements for showing the "Add to Homescreen" UI in Chrome, the answer is no. The beforeinstallprompt event should not be fired in that scenario.

like image 159
Jeff Posnick Avatar answered Oct 08 '22 19:10

Jeff Posnick