vincentmorneau / apex-pwa

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

Installation criteria are not met / prompt is undefined #12

Open Jantjevlith opened 5 years ago

Jantjevlith commented 5 years ago

Hi Vincent,

We have made some progress since our last ticket (https://github.com/vincentmorneau/apex-pwa/issues/11) but unfortunately we haven’t been able to get your demo working.

We did multiple clean installs of ORDS (18.2) on a new server (Windows Server 2016), trying both HTTPS and HTTP. We installed your demo app and followed your guide.

Manifest.json is found

image

Service worker is not found using Chrome (build 71.0.3578.98) but is found using Firefox (64.0.2).

image

image

Continuing on firefox:

If we press the install button (not visible by default so we manually adjusted visibility by editing the HTML/CSS directly). We get the following error-->

image

Also on chrome -->

image

We assume it has something to do with the fact that installation criteria haven’t been met (hence the button being invisible?). But since our service worker is seemingly working, the manifest has been found and we tried both http and https on localhost, we’re running out of ideas.

We haven’t tried using a valid SSL certificate, only self-signed ones, but shouldn’t it be able to work on localhost as that is considered a trusted source? For the sake of being complete, we also adjusted Chrome security flags to see if that helped, which it didn’t.

// This event will be triggered after installation criteria are met
window.addEventListener('beforeinstallprompt', function (event) {
  // Stop the automatic installation prompt
  event.preventDefault();
  // Store the event in a global variable so it can be triggered later
  installPrompt = event;
  // Controls the display (hide and show) of the PWA buttons
  pwa.ui.refresh();
});

If u could help it would be much appreciated

vincentmorneau commented 5 years ago

Let's see. Before we go any further, can you please confirm you meet the following criteria:

Jantjevlith commented 5 years ago
  • The web app is not already installed

verified using a mobile device which hasn't been connected before. (using chrome)

  • Meets a user engagement heuristic (currently, the user has interacted with the domain for at least 30 seconds)

done

image-1

Includes a web app manifest that includes:

  • short_name or name
  • icons must include a 192px and a 512px sized icons
  • start_url
  • display must be one of: fullscreen, standalone, or minimal-ui
manifest

screen shot 2019-02-01 at 10 19 39

  • Served over HTTPS (required for service workers)

done

  • Has registered a service worker with a fetch event handler

only in firefox (button didn't appear, manually adjust the css). Chrome fails. For complete story see initial post above.

serviceworker
pegasoseiya commented 5 years ago

I HAVE THE SAME TROUBLE Uncaught TypeError: Cannot read property 'prompt' of undefined at Object.pwa.install (app.js? [sm]:130) at HTMLButtonElement.onclick (f?p=104:1:::::::59) and using http without s.

carlosramirez37 commented 5 years ago

I got the same issue later had configured all well some help Plz. app.js:131 Uncaught TypeError: Cannot read property 'prompt' of undefined at Object.pwa.install (app.js:131) at HTMLButtonElement.onclick (f?p=102:1:59)

VccPlussApexMagic commented 5 years ago

Hello Dudes, i was going along all the steps and configurations, and i received the same issue written here, Cannot read property 'prompt' of undefined at Object.pwa.install (app.js:131) at HTMLButtonElement.onclick (f?p=106:2:59)

vincentmorneau commented 5 years ago

I understand that some of you are having problems with the pwa.install function, so I will revisit that part within the next week.

Can you provide the browser you guys are using?

carlosramirez37 commented 5 years ago

I understand that some of you are having problems with the pwa.install function, so I will revisit that part within the next week.

Can you provide the browser you guys are using?

THANK you before all, for your time, I'm in the personal using into Chrome Android native version - but also I have tested into firefox beta and not beta and the same issue . even I commented in the app.js the line install //installPrompt.prompt(); prompt to see what it's going on the next I received was userChoice property undefined of the var installPrompt .

VccPlussApexMagic commented 5 years ago

I understand that some of you are having problems with the pwa.install function, so I will revisit that part within the next week. Can you provide the browser you guys are using?

THANK you before all, for your time, I'm in the personal using into Chrome Android native version - but also i have tested into firefox beta and not beta and the same issue . even i commented in the app.js the line install //installPrompt.prompt(); prompt to see what it's going on the next I received was userChoice property undefined of the var installPrompt .

I am not an expert in Js programming but i try to debug where installPrompt var gets the object or similar PWA to have some property, it's would like declare apples having empty the nest, i am trying to debug for this reason appears the object like undefined, but till i don't get where the var takes that object to can have that property PROMT.

Thank you, Also Vincent for your dedication, and looking after our errors . I keep slope also .

\ Also Using Chrome Android -

pegasoseiya commented 5 years ago

Hi, i am using chrome opera firefox in the mobile phone.

pegasoseiya commented 5 years ago

For an error i got this even the manifest.json calls to the http protocol without ssl, i began to have error with ssl later installed glassfish - tomcat - ords , uninstalled re installed an related, , the things ssl stopped working ,when stopped, i try to access the install button and error changed to:

Uncaught TypeError: Cannot read property 'prompt' of undefined at Object.pwa.install (app.min.js:4) at HTMLButtonElement.onclick (f?p=104:1:::::::59)

what has in related the ssl ? if I'm not invoking in the json . anyway same prompt property.

Jantjevlith commented 5 years ago

I understand that some of you are having problems with the pwa.install function, so I will revisit that part within the next week.

Can you provide the browser you guys are using?

@vincentmorneau : Hi, maybe i missed it but have u already gotten the time to write on this topic?

Tnx for all your efforts.

vincentmorneau commented 5 years ago

Unfortunately no. It's still on my list of things to do, but I don't have much free time right now.