Cache Storage vs Application Cache - service-worker

how do we tell a browser that supports Cache Storage to ignore Application Cache? Some of the posts have mentioned that the browser ignores the html5 cache manifest. But my tests suggest otherwise.
For example, if the html page contains:
<html manifest="manifests/hudddle.cache">
and also has the service worker code (not shown here), I find that both sets of files are stored. I tested on Chrome 63 on Mac OS X.
Below is the image of files showing Cache Storage.
And here is the image showing Application cache.
Or am I supposed to check this on the server side and use only 1 of the two caching methods? Thanks

mdn doc about Application Cache says: Important: Application Cache is deprecated as of Firefox 44, and is no longer available in insecure contexts from Firefox 60 onwards (bug 1354175, currently Nightly/Beta only). Don't use it to offline websites — consider using service workers instead. and service workers use Cache Storage

Related

Cordova iOS - WkWebView offline

Application cache is deprecated which means we'll need to switch to service worker but I've done research it was mentioned..
1) "It is not possible to use a ServiceWorker in a Cordova app because the ServiceWorker API is not available to WKWebView and is not implemented in UIWebView. It is available in Safari on iOS, but not WKWebView."
//https://github.com/apache/cordova-ios/issues/414
2) Enabling appcache using private api is not working
//Enable Application cache in WKWebView
3) Cordova file & file-transfer plugin is not even recommended to use for production.
Is there any alternatives to be able to store artifacts (html, js & css files) and load for offline used? Our application needed to cached 300-400 files.
Appreciate your suggestions in advance! (:
Well to answer your question, my suggestion would be this: Get rid of those 400 files and find a more practical way to replace them.
Exactly why would you need to store so much CSS files in a Cordova app anyway? There's no logical reason that I can think of. Nor practical, loading other HTML files in the WebView goes against the SPA design principle.

Offline WebApp on iOS using CDN

I am trying to setup offline support for our webapp. I would love to use a serviceWorker for that but unfortunately Safari does not support those, yet.
So I tried using the deprecated manifest file. But apparently only files from the same origin are allowed in there. We are loading our static files from a CDN (so the origin is not the same).
Is there any way to make a webapp with CDN files work offline on iOS?
One last idea would be to generate a index-offline.html file, include that one as a FALLBACK in the manifest. In there, I would point to the same files but this time not on the CDN but on our own server... But this does not seem like a nice solution to me.
Thanks in advance :-)
Jesse
As long as iOS does not support service workers, you cannot make offline work. Service worker is the core of a PWA and that can make offline work properly. We as still not sure if iOS will support offline capabilities.

Cache Manifest with ASP.NET MVC Downloads Correctly, But Site Still Unavailable Offline

I'm working on an ASP.NET MVC web page that I would like to have available offline. I created a Cache Manifest file and included it as follows:
<html lang="en" manifest="/cache.manifest" type="text/cache-manifest">
(I included the "type" attribute because of Paul Styles' answer found here.)
The page I'm trying to cache is managed by the OfflineController.cs controller. The cache.manifest file itself reads as:
CACHE MANIFEST
# rev 5
NETWORK:
*
CACHE:
/offline
(I used this syntax for the paths because of ZippyV's answer found here.)
When I change the revision number and reload the page, the console shows:
Document was loaded from Application Cache with manifest https://[...]
Application Cache Checking event
Application Cache Downloading event
Application Cache Progress event (0 of 8) [...]
[...]
Application Cache UpdateReady event
This seems to mean that the manifest file was loaded correctly. Furthermore, when I Inspect the page and view Resources > Application Cache > cache.manifest, all 8 files are shown to have been downloaded.
However, when I unplug my Ethernet cable and navigate to ~/offline, the site does not load. Any ideas why? Thanks!
Was this error ever fixed? I realize that this was asked quite a while ago.
Update:
Hopefully this helps anyone else who come across this, this sound like a similar issue.

Why doesn't my iOS standalone web app re-retrieve cached images from the server?

I have created a single page website that is designed to be installed on the iOS home screen and accessed as a standalone web app. It's a single page and a cache.manifest ensures that the related assets are cached offline.
After a lot of ups and downs the whole thing now seems to work on and offline. However there's one issue that confuses me. Only when I start the page from the home screen, some assets that aren't cached are not retrieved from the web, even though there is a connection. I have an offline fallback for these assets, but I only expect the fallback to kick in when there is no available connection.
My cache.manifest looks like this:
CACHE MANIFEST
# 2013-01-28:v2
# Explicitly cached 'master entries'.
CACHE:
gfx/logo.png
styles/default.css
scripts/default.js
(...lots of other assets...)
gfx/slide.jpg
# Resources that require the user to be online.
NETWORK:
*
# Fallback when offline.
FALLBACK:
content/slides/ gfx/slide.jpg
The images in the content/slides/ directory are not cached. If there is no connection I want each image to be replaced with gfx/slide.jpg which is cached and this works. When there is a connected, I expected that the NETWORK: * directive would ensure that images from the content/slides/ directory would be retrieved from the web, but that doesn't happen.
Is there anything I need to change in the manifest file to indicate that images from content/slides should be retrieved from the web before they fall back to using gfx/slide.jpg?
Has anyone else experienced getting stuck in the fallback rule even when the page is accessed later on with an available internet connection?

Want to open a dialog box to open file in web browser based application

Am using JSF and primefaces to develop web application.I want to open existing files on client machines using dialog box which prompts the user to select a path and the corresponding file. Please suggest a component which can be used.
While I doubt the feasibility of your intentions; accessing content directly on a client's machine (some security implications there), a combination of <p:media/> and <p:lightBox/> will work for you. There are file type restrictions imposed by primefaces though (multimedia files and pdf only) The <p:media/> can be embedded in the <p:lightBox/> like so :
<p:lightBox>
<p:media value="{yourBean.filePath}" width="100%" height="300px">
</p:lightBox>
Like I said, I doubt the feasibility of directly streaming content from a client's local filesystem. How do you intend to use the path c:\Users\john doe\my documents\my books\book.pdf on a user's local system within your own web application, without first uploading the file to your own webserver? With image files, you might have some success loading the file into memory and streaming the file directly from RAM using <p:dynaImage/>...consider the scalability of this option too for a high traffic application

Resources