Offline.js | A drop-in to replacement for App Cache | Caching library

 by   puppybits JavaScript Version: Current License: No License

kandi X-RAY | Offline.js Summary

kandi X-RAY | Offline.js Summary

Offline.js is a JavaScript library typically used in Telecommunications, Media, Telecom, Server, Caching, Xcode applications. Offline.js has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.

A drop-in to replacement for App Cache.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              Offline.js has a low active ecosystem.
              It has 8 star(s) with 2 fork(s). There are 3 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              Offline.js has no issues reported. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of Offline.js is current.

            kandi-Quality Quality

              Offline.js has no bugs reported.

            kandi-Security Security

              Offline.js has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              Offline.js does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              Offline.js releases are not available. You will need to build from source code and install.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Offline.js
            Get all kandi verified functions for this library.

            Offline.js Key Features

            No Key Features are available at this moment for Offline.js.

            Offline.js Examples and Code Snippets

            No Code Snippets are available at this moment for Offline.js.

            Community Discussions

            QUESTION

            Serviceworker never gets activated or receives messages but workbox functionality works on subpaths
            Asked 2020-Jun-18 at 11:39

            In my current project using webpack with (workbox-webpack-plugin) and workbox (with workbox-window) I have encountered an error where the serviceworker will never respond to messages when the page is loaded at a "deep url", like "/my-path/is-nested". It will work on "/my-path".

            In a minimal reproducible environment, this is supposed to happen.

            • In a new tab, app is accessed (e.g. via https://my-app.my-name.company-dev-envs.cloud/some-unique-id)
            • ServiceWorker gets registered via workbox (.register())
            • upon registration, messageSW is used to ask for the SWs "version"
            • ServiceWorker responds using event.ports[0].postMessage with a string indicating the version

            Is the site accessed in a "deep" path, like /some-unique-id/test, the messaging will never work.

            Workbox does successfully "register" - but no events will be fired (except externalactivated when Update on Reload in the Application > Service Worker Tab is selected) The serviceworker will be reported as "active and running" with no other service workers displayed. It seems to handle fetches okay too. Only messages and events never respond/fire via the wb Workbox Window instance.

            The "application" tab reports the service worker as active and running:

            index.js (main entry for application)

            ...

            ANSWER

            Answered 2020-Jun-18 at 11:39

            I was able to solve it myself. The issue was of course that the path to ./sw.js is not correct when the user navigates to a subpath.

            https://my-website.com/a-subpath/a-resource does not resolve ./sw.js to https://my-website.com/sw.js but rather to https://my-website.com/a-subpath/sw.js

            This was a very dumb mistake but hopefully somebody can be helped with this answer. Perhaps it would be helpful if workbox-window didn't resolve correctly as if the registration were a success, but rejected the ./sw.js path.

            Source https://stackoverflow.com/questions/62427020

            QUESTION

            caching a dynamic view PWA ASP
            Asked 2019-Dec-29 at 15:14

            I have a question about caching in PWA.
            I would like to let user choose a list to cache. For example: User creating few lists, and then he choose one, to save for offline. When he is offline he can only open 2 views:
            1. smth like "u are offline, do you want to open saved list?" (if it exist)
            2. View with saved list.

            At this moment, I am caching all views that user visited, but can't cache views with dynamic data.
            I'm using PWA.essentials to do PWA.


            ...

            ANSWER

            Answered 2019-Dec-29 at 15:14

            You are saving the user selected pages’ list at server side in offline.json and you are caching that file too. As per working of PWA cached resources are served from cache and not from server until cache is removed/cleared.

            You can take 2 approach.

            1. Whenever user adds to the offline.json you need enforce service worker to update the offline file.

            2. You can simply store the user selecting in local storage and from there you add pages to cache list.

            Source https://stackoverflow.com/questions/59518055

            QUESTION

            Making offline.js work with turbolinks
            Asked 2019-Dec-12 at 01:31

            I am using offline.js with turbolinks and on initial page load it works fine. But if I click another links then this wont work until I refresh the page. I can see the Offline.state is down but still the view is not showing. Is there any way to manually trigger the popup window?

            Update

            Other than the offline.js file the only js I have is this

            ...

            ANSWER

            Answered 2017-Mar-06 at 04:18

            This could be a turbolinks issue. In app/assets/javascripts/application.js, wrap your javascript code within:

            Source https://stackoverflow.com/questions/42617343

            QUESTION

            Retrying a failed dynamic import? (SPA/PWA)
            Asked 2019-Oct-11 at 20:41

            Something that I'm running into with a project I'm working on is, I have a single page application. I'm handling browser navigation routing on the client-side, that lets me dynamically import some modules whenever a route is matched. My routing setup looks a bit like this:

            ...

            ANSWER

            Answered 2019-Oct-10 at 13:01

            The browser is not doing that sort of caching/deduping/whatever. You can verify this easily by calling import from the console and toggling your network online/offline.

            So the problem is most likely with the framework you're using. The caching of the first call to the route action happens somewhere in the framework. Maybe consult the documentation?

            Source https://stackoverflow.com/questions/58311129

            QUESTION

            Workbox redirect the clients page when resource is not cached and offline
            Asked 2019-Oct-10 at 11:16

            Usually whenever I read a blog post about PWA's, the tutorial seems to just precache every single asset. But this seems to go against the app shell pattern a bit, which as I understand is: Cache the bare necessities (only the app shell), and runtime cache as you go. (Please correct me if I understood this incorrectly)

            Imagine I have this single page application, it's a simple index.html with a web component: . That component sets up some routes which looks a little bit like this, I'm using Vaadin router and web components, but I imagine the problem would be the same using React with React Router or something similar.

            ...

            ANSWER

            Answered 2019-Oct-10 at 11:16

            Option 1 (not always useful): As far as I can see and according to this answer, you cannot open a new window or change the URL of the browser from within the service worker. However you can open a new window only if the clients.openWindow() function is called from within the notificationclick event.

            Option 2 (hardest): You could use the WindowClient.navigate method within the activate event of the service worker however is a bit trickier as you still need to check if the file requested exists in the cache or not.

            Option 3 (easiest & hackiest): Otherwise, you could respond with a new Request object to the offline page:

            Source https://stackoverflow.com/questions/58276661

            QUESTION

            Reading file names in path and writing on JSON file
            Asked 2019-Jul-03 at 20:52

            I have a file directory in C:Data\ like

            How can I write on an existing JSON file called Offline.json to be like:

            ...

            ANSWER

            Answered 2017-Nov-25 at 00:32

            Using Newtonsoft Json.NET this is kinda easy to accomplish:

            Source https://stackoverflow.com/questions/47481519

            QUESTION

            Using Offline.js in Node
            Asked 2018-May-08 at 13:47

            I'm having a hard time to make use of the Offline.js in NodeJS. I've used the Offline.js like the following but it always shows check() is undefined or any other methods.

            ...

            ANSWER

            Answered 2017-Apr-08 at 10:52

            So, I came up with the following solution using the [isOnline package].1 as Offline.js doesn't work in Node or on the server side.

            Source https://stackoverflow.com/questions/43186502

            QUESTION

            Vue.js 2 & webpack / npm start opens and reloads in FF instead of Chrome
            Asked 2018-Jan-29 at 17:49

            I am following the Vue.js tutorial "The Ultimate Vue JS 2 Developers Course"(Project 2) and I am running into an issue with the browser refresh on file change. I am on Kubuntu 16.04 and my system's standard browser is Chrome, but yet, every time I change a file in my project, webpack tries to open Firefox, which is not installed on my system (and I don't want to use Firefox, but Chrome).

            I already went through the webpack.config.js, but I just can't figure out, where I could change settings for the browser.

            webpack.config.js

            ...

            ANSWER

            Answered 2018-Jan-28 at 10:38

            Your project is using the open library in order to open a URL in a browser. Specifically this line, in server.js file:

            Source https://stackoverflow.com/questions/48481403

            QUESTION

            Html5 application cache not working correctly on iPhone
            Asked 2017-Jun-18 at 17:59

            I'm trying to build a web-application shopping list. I want to use the html5 application cache to view the list when offline. The shopping list items are stored in local storage. On my laptop everything works fine but on my iPhone, it seems that all pages are cached while this is not my purpose.

            ...

            ANSWER

            Answered 2017-Jun-18 at 17:59

            After a long search, I found a solution that works for me. I discovered that the application cache feature is not yet totally supported by all browsers. With the help of the link below I came to a working solution. It's not the most elegant solution but it works in Firefox, Edge and Safari.

            https://www.html5rocks.com/en/tutorials/appcache/beginner/

            Source https://stackoverflow.com/questions/44334582

            QUESTION

            Offline.js doesnt work
            Asked 2017-Mar-15 at 12:24

            I am using Offline.js to check my Internet connection in a simple web app. The problem is that i receive only the first connection message and then nothing.

            ...

            ANSWER

            Answered 2017-Mar-15 at 12:13

            Your script works fine, unless you run it locally using the file:// scheme.

            The point is that Offline.js makes requests to /favicon.ico to the domain, it is currently running on. For the local scheme, requests to itself can yield a security threat. Therefore it is disabled by default.

            1. You can start Google Chrome using the --allow-file-access-from-files argument to make it work.
            2. In Mac or Linux, go into the folder of your files and run python3 -m http.server. Then go to localhost:8000/ in your browser and locate your HTML file.

            Using these approaches, the HTML files will be served over HTTP and it can make proper AJAX calls and Offline.js works again.

            In short: Offline.js does not work in file:// schemes.

            Source https://stackoverflow.com/questions/42808839

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install Offline.js

            Create a file called appcache.manifest.
            Make sure your server supports manifest mime types. For Apache open the mime.types and add text/cache-manifest manifest.
            Add the manifest to your html tag <html manifest="appcache.manifest">.
            Add offline.js.
            Call offline.prime() to download everything in the DOM.
            Call offline.activate() to replace DOM nodes with local storage cache.
            In order to update the main html after the inital load, delete the app cache browser storage. In chrome use: chrome://appcache-internals.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/puppybits/Offline.js.git

          • CLI

            gh repo clone puppybits/Offline.js

          • sshUrl

            git@github.com:puppybits/Offline.js.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Consider Popular Caching Libraries

            caffeine

            by ben-manes

            groupcache

            by golang

            bigcache

            by allegro

            DiskLruCache

            by JakeWharton

            HanekeSwift

            by Haneke

            Try Top Libraries by puppybits

            BackboneJS-PerfView

            by puppybitsJavaScript

            QTransform

            by puppybitsJavaScript

            Jank-Vision

            by puppybitsJavaScript

            Threads.js

            by puppybitsJavaScript

            prefmatters-browser-pipelines

            by puppybitsJavaScript