After long hours searching on SO and Github, I found imgCache.js, a JS library that handle file cache for Chrome, Android and iOs (through Cordova).
https://github.com/chrisben/imgcache.js/
Then, basically :
var target = $('.cached-img'); ImgCache.isCached(target.attr('src'), function(path, success){ if(success){ // already cached ImgCache.useCachedFile(target); } else { // not there, need to cache the image ImgCache.cacheFile(target.attr('src'), function(){ ImgCache.useCachedFile(target); }); } });
Related Posts:
- Clear the cache in JavaScript
- How do you completely remove Ionic and Cordova installation from mac?
- How To Save Canvas As An Image With canvas.toDataURL()?
- Which equals operator (== vs ===) should be used in JavaScript comparisons?
- are there dictionaries in javascript like python?
- Dynamically creating charts of each row in an HTML table with chart.js
- jQuery .on(‘change’, function() {} not triggering for dynamically created inputs
- How to create a jQuery function (a new jQuery method or plugin)?
- Failed to load resource: the server responded with a status of 500 (Internal Server Error) in Bind function
- Scroll to an element with jQuery
- Cannot open local file – Chrome: Not allowed to load local resource
- How do you reverse a string in-place in JavaScript?
- How to get the browser to navigate to URL in JavaScript
- Uncaught TypeError: Cannot read property ‘length’ of undefined
- Python to JavaScript converter
- Set style using pure JavaScript
- SyntaxError: Unexpected token o in JSON at position 1
- Fastest way to duplicate an array in JavaScript – slice vs. ‘for’ loop
- What is the difference between call and apply?
- AJAX response error: net::ERR_EMPTY_RESPONSE
- TypeError: Cannot Set property ‘onclick’ of null
- Sorting strings in descending order in Javascript (Most efficiently)?
- JavaScript function in href vs. onclick
- How to scroll to an element?
- How would I call a javascript function in html?
- Mismatched anonymous define() module
- Function is not defined – Uncaught ReferenceError
- How do I include a JavaScript file in another JavaScript file?
- Textarea Auto height
- Angular 2 – Using ‘this’ inside setTimeout
- Download data URL file
- Why use Redux over Facebook Flux?
- What does the construct x = x || y mean?
- Discord error cannot read property ‘isFocused’
- onClick not working React js
- What language is JavaScript written in?
- How to output numbers with leading zeros in JavaScript?
- Remove not alphanumeric characters from string
- Scroll to bottom of div?
- How to instantiate a File object in JavaScript?
- How to change the buttons text using javascript
- How to sort in mongoose?
- “Uncaught TypeError: a.indexOf is not a function” error when opening new foundation project
- How do you serve a file for download with AngularJS or Javascript?
- JavaScript array to CSV
- window.onload vs $(document).ready()
- Detect a finger swipe through JavaScript on the iPhone and Android
- console.log showing contents of array object
- How to sort 2 dimensional array by column value?
- anchor jumping by using javascript
- jQuery scrollTop() method not working
- FormData append not working
- How to convert binary string to decimal?
- How to change href of tag on button click through javascript
- parsing JSONP $http.jsonp() response in angular.js
- d3.scale.category20 is too smart for me
- JSLint is suddenly reporting: Use the function form of “use strict”
- wp_add_inline_script without dependency
- How to configure WordPress to be able to use tag inside posts?
- Extend core block in Gutenberg
- Correct place to register and enqueue scripts
- How to add JS in footer
- Localhost load-scripts.php Error 500 in Dashboard [closed]
- Javascript not included
- How to run JavaScript function in WooCommerce checkout?
- Accessing customizer values in javascript
- How to load javascript file on homepage in WordPress in order?
- How do display simple page for printing product info? [closed]
- Insert “javascript:void(0);” into URL
- What is the “proper” way to generate a javascript variable depending on a custom field value?
- Render blocking issue in google page insight
- Adding nonce or hashes to inline scripts
- Open MediaUpload from external component in Gutenberg
- WordPress Media Library: Custom tab content displayed in “Media Library” tab
- Manually mark imported photo as selected in media library
- How to retrieve data from database, then pass it to Javascript?
- Call post-id from URL hash not working?
- wordpress 4.4 upgrade visual editor bullets select for not selected elements
- Easy popups for wordpress?
- Script to Automatically Advance to the Next Page of a Paginated Post
- How can I get user data into a javascript object?
- Why WordPress not using JSON_UNESCAPED_UNICODE by default?
- WordPress load-scripts.php not loading
- Add script to page at certain location in wordpress
- get_header() in backend – but keep JavaScript and CSS files
- Absolutely print script in footer
- How can I put this JavaScript into WordPress? [closed]
- Need help in fixing javascript in WordPress
- Uncaught TypeError: r is not a function
- How to show cities according to the state in Form using Javascript? [closed]
- Redirect to homepage if attmpting to leave intranet [closed]
- Twenty seventeen theme dropdown menu issue
- How to correctly load this jquery script through the file functions.php?
- Unserialize WP_Options options programatically?
- javascript errors on mobile browser, not on desktop
- Loading 2 Different Version of JS files [closed]
- Adding react app to an existing wordpress website
- How to load JavaScript modules with script_loader_tag hook?
- How to securely set dynamic HTML content with JavaScript?
- How can I look at/edit what’s being sent to post.php when I hit the publish/update button?