How to stop auto load on cordova meteor? - ios

I am creating ios app using meteor and i have all the assets in the public folder, but still my app downloads assets from the server when it loads for the first time.
I am trying to stop auto reload or auto update on cordova.
I have tried this but didnt work.
if (Meteor.isCordova) {
Reload._onMigrate(function (retry) {
return [false];
});
}

I see two possibilities :
onMigrate
Use this on client side (/client folder)
Meteor._reload.onMigrate(function() {
return [false];
});
AUTOUPDATE_VERSION
$ AUTOUPDATE_VERSION=abc meteor
You can set the AUTOUPDATE_VERSION environment variable to something static, it will prevent autoupdate.
See Meteor Doc.
Edit note : mdg:reload-on-resume doesn't work on iOS. Issue #72.

Have you looked at the reload on resume package? Not on IOS at this time, sorry!
Add it to your Meteor app with meteor add mdg:reload-on-resume. This
package changes the behavior of Meteor's hot code push feature on
mobile devices only.
Normally, your app will update on the user's device as soon as you
push a new version. This process is always smooth in a desktop web
browser, but might momentarily interrupt the user's experience if they
are on a mobile device.
With this package, the app will only update itself to the newest
version if the user closes and re-opens the app (hence, it "reloads on
resume").
The Appcache package will stop your app downloading when it first loads
Once a user has visited a Meteor application for the first time and
the application has been cached, on subsequent visits the web page
loads faster because the browser can load the application out of the
cache without contacting the server first.

Related

How to enable offline PWA app with Electron?

I created a progressive web app and am using electron for app distribution to use some native features.
The PWA app works fine offline in Google Chrome.
The PWA updates work fine in the electron app but starting app offline fails to load anything. Using the inspector, the service workers are running.
No errors in the console and page is blank.
Is there a trick I am missing ?
PS: when loading page online, the network tab shows that all assets except the index page are served by the service worker. Oh, and on Google chrome, there is a (disk cache) for index page. This might be it.
After more testing I realised that this was an issue with my webpack configuration.
I use WorkboxPlugin to build the manifest and it was placed before HtmlWebpackPlugin and needs to come last. This was why the index page was not working: it was not in the manifest.

Cordova PWA application offline mode

I have made an angular + workbox application that now is converted using PWABuilder to Cordova project targeting ios platform.
Now my problem started with offline page, I want my application to work the same way it works on chrome browser with offline mode.
That is, even if I'm in offline mode, I'm able to use website and store the requests for later on.
But on IOS device, when I open application, then turn airplane mode or disconnect wifi and re-run an app a white screen appears. (Offline page support is disabled in manifest.js - I don't need Offline.html)
I have registered routing by
workbox.routing.registerNavigationRoute('/');
And then
// couple of following lines:
workbox.routing.registerRoute('regex with js,manifest...etc', networkFirstStrategy({cacheName} ...)
And the weird fact is that on ios this somehow can't be cached, or somethings different happens.
I'm waiting for any suggestions, or leads that can help me fix this behaviour.
Answer
The WebView as used by Cordova in the latest iOS (12.0.1) will not run Workbox because it doesn't support Service Workers.
Details
Cordova apps run in a WebView.
The app executes in a WebView within the native application wrapper... source
The WebView in the latest production iOS (12.0.1) only supports Service Workers within three specific contexts, which doesn't include Cordova apps.
At this time [the Service Worker API] is only available in Safari, applications that use SFSafariViewController, and web applications saved to your home screen. source
Next Steps
It may be possible to add Service Worker support via a Cordova Plugin. For example: cordova-plugin-service-worker.
In addition, you may also need to add Background Sync support as the latest Safari does not support Background Sync. For example: cordova-plugin-service-worker-background-sync.
The Workbox docs state that they provide a fallback strategy when Background Sync is not supported:
Workbox Background Sync...also implements a fallback strategy for browsers that
don't yet implement BackgroundSync. source
However, an open issue on Github shows that the fallback strategy may not work on iOS.

HTML5 web app not caching when added to home screen on iOS

I have web application ASP/MVC which uses application cache and it has to work as standalone application when added to home screen. It works fine, but on iOS10 it doesn't cache and doesn't work on offline mode. I don't have exact steps but it seems like it stops workign when i add this application for second/third time:
1 I add application to home screen and it works properly
2 I add this application to home screen again - it doesn't work
And all next installed applications doesn't work.
Also i wasn't able to reproduce it on one of the test servers.
I would try to clen cache (maybe it would help) but because of atandalone applications are opened not in Safary on iPhone - i don't know how to do this.
Also i found script to debug application cache
https://jonathanstark.com/blog/debugging-html-5-offline-application-cache?filename=2009/09/27/debugging-html-5-offline-application-cache/
But when i run application which doesn't work in offline mode - it simply doesn't enter in any of events handlers.
Found out what the problem was. There was redirecting on another page on my site and you could redirect even if application cache is still loading content so the caching stops and after redirecting back we on purpose setted manifest to empty string (it turned out like a feature that after redirecting back caching doesn't start being loaded). But on another OS caching started loading according to previous manifest, and only for iOS 10 if manifest turns out to empty string - caching doesn't start.

Offline iOS7 web app: doesn't update manifest

I have written a web app for offline usage on iOS7 safari and, while it does download the files in the manifest for offline usage, it never updates cached files when the manifest changes.
I have a php script that loops through files in a directory and creates a cache.appcache file. It also adds a comment that is a md5 of the files so that each time a file changes, the cache.appcache file will update.
This works fine on desktop chrome and the app cache update is triggered. However, on the iPad it never tries to update the cache: I have to clear the device's cache manually to get the updated app.
Is there something I'm missing?
http://html5doctor.com/go-offline-with-application-cache/#trigger-refresh
Updates in the cache.manifest file are supposed to trigger cache updates. This was happening on desktop browsers but not on the iPad.
For future reference this appeared to be caused by a combination of iOS 'web app' mode and the HTTP Auth password I had on the page. It seems that this combination prevented the cache update check because it worked fine in regular iOS safari but only worked in both after I removed the password.

ipad every time launch sencha touch 2 web app from home screen application reload from beginning

I have a web application based on sencha touch 2 framework.
simply when adding home screen shortcut in iPad and open the application each time application restart from beginning and iPad didn't save the state of current page.
The Cache size of my application about 2MB.
Can I save state of my application like Safari ?
To go offline you should configure app cache manifest and specify the resources that are available online or offline.
Read the following
http://www.sencha.com/learn/taking-sencha-touch-apps-offline/
http://www.w3schools.com/html5/att_html_manifest.asp
Try configuring routes for your controller action. That way the state is persisted through the url when you switch back.
Try to wrap the web application to the native one using cordova (formerly phonegap) package.

Resources