vincentmorneau / apex-pwa

A complete guide for turning an APEX application into a Progressive Web App
MIT License
82 stars 26 forks source link

Multiple PWA apps on same server #16

Open JustAPhrog opened 5 years ago

JustAPhrog commented 5 years ago

Hi, In our company we have one server with APEX and we want to implement this great (!) future. Is it possible to serve multiple manifests for different apps? How to achieve it? APEX 18.2 on Tomcat on Linux ORDS 18.4.0.r3541002

vincentmorneau commented 5 years ago

Yes, you can name the manifest json file and service worker javascript file anything, and reference those different files in your different apps ;)

JustAPhrog commented 5 years ago

@vincentmorneau It's great to hear it. I'll try it 🙂

Habouassaf commented 3 years ago

Hello i know this is an old post @JustAPhrog did you try this? i couldn't make it works for multiple apps

vincentmorneau commented 3 years ago

What's the problem?

Instead of naming manifest.json and sw.js, you can do:

app1manifest.json and app1sw.js then app2manifest.json and app2sw.js

Habouassaf commented 3 years ago

thank you for the replay i did what you mentioned but the problem is once i installed one application i can't install the other one in both manifest files i defined start_url and scope like : "start_url": "https:/myserver/pls/apex/f?p=175:1", "scope": "https:/myserver/pls/apex/f?p=175", and in the other "start_url": "https:/myserver/pls/apex/f?p=1000:1", "scope": "https:/myserver/pls/apex/f?p=1000",

when i try to install the second app beforeinstallprompt event not triggered and if i force click on install button this error raised: Uncaught TypeError: Cannot read property 'prompt' of undefined at Object.pwa.install (app.js:175)

vincentmorneau commented 3 years ago

Sorry, this isn't enough for me to debug.

.prompt is a function of the service worker object. If the message is "Cannot read property 'prompt' of undefined" that means the app service worker has not been registered. You need to understand the logic of the JS files, copy paste is not enough.

I've been using this library lately: https://github.com/pwa-builder/pwa-install which works quite well at browser compatibility messages and instructions.

Habouassaf commented 3 years ago

thank u for your time i will check this library, and just to know in my case service workers registered,activated and running correctly :) in both apps push notification, cashing , online offline notification all are running just fine, except for the install button in second app not working.