pwa-builder / PWABuilder-CLI

Node.js tool for App Generation
Other
1.63k stars 142 forks source link

Detect Manifoldjs #260

Closed SrMordred closed 7 years ago

SrMordred commented 7 years ago

Is possible to detect that my site are being accessed with manifoldjs? I want to make some modification on this case but the js injection work after the page is loaded, but I need it to be before. There is any workaround on this?

boyofgreen commented 7 years ago

yea, this is still a gap, because on some platforms (like windows 10) the user agent is different when it is a PWA, but most of the time it is the same. you may be able to do some feature detection for APIs, anyone else know?

boyofgreen commented 7 years ago

I went back and looked at the issues in the manifest spec, and found a solution for you. the official recommendation is to add a query string parameter to the start URL on the manifest. For example, your site is https://www.mysite.com/ and you make the start url https://www.mysite.com/?inApp=true. This way you can do a detect for this in your URL and know you are in the app. Should work for all platfroms and polyfills.

SrMordred commented 7 years ago

Hello again. I tried this solution url/?variable=value : It open the hosted site correctly, but after some seconds (10-15 secs) it crashes with this message(i´m on Android):

Application Error The connection to the server was unsuccessful. (https://myurl.com.br/?manifold=1)

My site uses Angular 1.5 not sure if this can be related. I opened the url with the browser and everything works ok.

SrMordred commented 7 years ago

Nvm. It is happening with any link regardless. Yet still did´nt know whats happening since the app open and the hosted site are showed properly, just to crash some seconds later.