progressive-web-apps

Angular Service Workers Routes

时光怂恿深爱的人放手 提交于 2020-01-01 05:15:11
问题 I have built an app with Angular Service worker and it is all working well offline except for the routes. If I go to the base url the app loads fine but if I go to any of the other routes while offline I get an offline error. My ngsw-manifest.json looks like { "routing": { "index": "/index.html", "routes": { "/": { "match": "exact" }, "/home": { "match": "exact" }, "/paramaterlessroutes": { "match": "exact" }, "/routeswithparamaters": { "match": "prefix" } } } } 来源: https://stackoverflow.com

How to handle images offline in a PWA share target?

て烟熏妆下的殇ゞ 提交于 2020-01-01 05:13:08
问题 I can register my Progressive Web App as a share target for images (supported from Chrome Android 76): "share_target": { "action": "/share-target", "method": "POST", "enctype": "multipart/form-data", "params": { "files": [ { "name": "myImage", "accept": ["image/jpeg", "image/png"] } ] } } I can then intercept attempts to share images to the app in a service worker: self.addEventListener('fetch', e => { if (e.request.method === 'POST' && e.request.url.endsWith('/share-target')) { // todo } })

'Unexpected token <' on every new build of angular production PWA until site refresh

白昼怎懂夜的黑 提交于 2020-01-01 04:18:32
问题 I know there are some similar questions like so unexpected token after angular 2 production build but it doesnt actually answer my question. Basically I have an angular app and its a PWA, now everytime I do a new production build the first time I visit the site I get an error like so and then as soon as I refresh the page, the site works as normal. This happens on any browser/device Now my suspicion is that every time the app is updated, the main bundled js file changes, and the PWA has

check if user has already installed PWA to homescreen on Chrome?

删除回忆录丶 提交于 2019-12-31 09:23:48
问题 I'm trying to create an "Add To Home Screen" button on my progressive web app, as described in Chrome's documentation. I'm generally following the prescribed pattern, where I have some hidden button which is displayed when Chrome's beforeinstallprompt event fires. I capture the event once it fires, and then use the event to begin the native install dialogue once my own install button is clicked. The sample code is below: let deferredPrompt; window.addEventListener('beforeinstallprompt', (e) =

Check if web app is added to home screen on Android

纵饮孤独 提交于 2019-12-29 07:37:07
问题 I have a web app and on the Android I would like to display an alert describing how to add my app to the home screen. (Add it to "Bookmarks" and then "Add it to home screen" or "Add to shortcut in Home"). Then a icon will be displayed on the screen that opens my app. But off course I only want this to show if the app is not added to the home screen. Does anybody know how to do this? Any input appreciated, thanks. 回答1: Yes, you can. While technically a page open in Chrome browser tab can't

Can we run firebase realtime listening on ios serviceworker?

余生长醉 提交于 2019-12-28 12:47:03
问题 As of iOS 11.3 there is serviceworker feature supported Even though it has no support for notification. I wonder if it possible to just run any realtime listener, such as firebase database, to receive realtime data and use ServiceWorkerRegistration.showNotification to show local notification instead Is it possible? 回答1: While iOS don't support Web Push notifications yet(as of Apr-2018), all you can do is have an event listener for data from server side(Firebase in your case) and receive that

Call a function every minute from a service worker for an offline PWA [closed]

…衆ロ難τιáo~ 提交于 2019-12-25 18:05:36
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I'm working on a Progressive Web App (PWA) with offline support and I need to call a function in the app every minute from the service worker. (to send a web API based push notification if the user is offline) What is the best way to do this? 回答1: to call the function every minute use setInterval(): function

Call a function every minute from a service worker for an offline PWA [closed]

不问归期 提交于 2019-12-25 18:05:18
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I'm working on a Progressive Web App (PWA) with offline support and I need to call a function in the app every minute from the service worker. (to send a web API based push notification if the user is offline) What is the best way to do this? 回答1: to call the function every minute use setInterval(): function

How do I Git pull an Angular app to a local Angular-pwa enabled project?

核能气质少年 提交于 2019-12-25 01:21:26
问题 I created an angular app which I pushed to my Bitbucket repository. To turn my angular app into a Progressive Web App, I followed this step by step guide. The result, was a newly created folder (as per the guide) called angular-pwa . I then cd into the angular-pwa and pulled my app from the repository. The commands I used to pull my app: git init . git remote add origin https://myName@bitbucket.org/myName/myAppName.git git pull origin master I never saw any error messages following the above

How to base64 encode binary image in JS for browser showing

夙愿已清 提交于 2019-12-25 01:17:19
问题 We have a problem with showing in browser (actually Chrome) binary images receiving from REST backend API. The backend REST endpoint defined in Java like this @GetMapping(path = "/images/{imageId:\\d+}/data", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) public @ResponseBody byte[] getImageData(@PathVariable long imageId) { return ... skipped ... } On the frontend we do these steps: request image data via fetch JS method call async function getImage(id) { return await fetch(`${URL}