More than 1 cache manifest file? - html

Is it possible to use more than one cache manifest file?
Does the html manifest attribute support more than one file?
If it does, how can i do that?
The idea is to include files in the cache list whitout losing the cache of the earlier files. That's because when we change the manifest file, the files in the list are downloaded again.

No, for a given page you can only have 1 cache manifest file.

Related

Inject/Remove HTML via Chrome Extension

I'm making a chrome extension and on a specific web page I have a table that has commented out information.
I'd like to remove the comment syntax so that the information is displayed in the table
What kind of content script would I need to parse the HTML for the specific comment syntax and then remove it?
Also, every time I pack my extension to a .crx file the file size nearly doubles. Is this standard? My 16 kb files are turning into a 40 MB extension- I'm worried that it isn't supposed to work like that.
First off, likely when you package your extension into a .crx file, you're putting the resulting .crx file in the same folder as your source files.
Then the next time that you package the extension, instead of your source folder having just the files you want to package, it has the files you want to package plus the previous .crx file. Every time this happens you effectively (just over) double the file size. To prevent this, make sure the .crx file is getting saved to the parent directory.
As far as the uncommenting HTML goes, I would check out this answer:
Uncomment html code using javascript

Can the code in a .crx chrome app have write access to the files within itself (the crx)?

I have a crx that has a number of files that I want to be able to change over time. For example, it might have this structure:
index.html
js/code.js
images/someimage.png
I want to be able to use ajax (or JSONP) to download a new image and overwrite image/someimage.png (after the crx has been installed into chrome). Is this possible?
No, you can not modify the application / extension data files directly.
But, you can store a downloaded image to chrome.storage, chrome.fileSystem, or chrome.syncFileSystem. At run time you can check to see if a downloaded image is there and swap out your image reference. E.g. use a dataURL or blob.

html5 cache manifest setting up

According to the manual I read online, in order to use cache manifest, I need to do the following two steps:
1. I need to add 'AddType text/cache-manifest .manifest' in a .htaccess file.
the question is where can I find .htaccess file?
2. compose a new file called offline(DIY name).manifest.
Question is: where should I put this file? Is it under www file or somewhere else?
If I am right, both files should be in your root of that page. Same place where your HTML file is.

html5 local storage for offline viewing

I have a folder, which contains html files, images, stylesheets, and js.
I have uploaded it to the server and when i open it on ipad, all the content should get stored on iPad for offline viewing. How can this be done using webstorage / local storage?
I tried with offline cache but it has its limit of 5MB
Your webserver has to support this by adding
AddType text/cache-manifest .manifest
to your .htaccess or server config.
then you need a manifest file, which says the client "store these files locally". Just create a blank file call it something like "data.manifest" and add this:
CACHE MANIFEST
CACHE
index.html
style.css
etc..
There are many more things you can do in this manifest file. I consider using Google or the search for this.
At least you have to edit your <html>-tag for your manifest file to your site.
<html manifest="/data.manifest" />
That's it. The browser should ask you whether it should store data locally.
You have to split your app in two. A downloader and the actual app.
The downloader will download the required files once and save it to localstorage/webstorage. Once saved your app can be loaded from local copy directly. The downloader part will be saved using cache manifest mechanism.
I am currently developing an app which works in the same way.
Note: JS and CSS files can be saved directly to localstorage, but for images you have to convert them to base64 and then use them. Watch out for the base64 size limitations.
http://en.wikipedia.org/wiki/Data_URI_scheme

Cache manifest and query strings

I am investigating using a cache manifest. If I have a manifest such as:
CACHE MANIFEST
stylesheets/style.css
And in the page I have a CSS element referencing stylesheets/style.css?v=123.
Will the style.css file be retrieved from the cache or remotely?
The URL in the cache manifest and the URL you're calling must match (INCLUDING the query).
In your example:
CACHE MANIFEST stylesheets/style.css
in HTML: stylesheets/style.css?v=123
The browser will ALWAYS try to fetch the CSS file from the server, since only the query-less CSS file is cached locally. Use of stylesheets/style.css in cache is sufficient.
Just an additional note: if you have HTML pages that expects data in query strings, you could store the same data in localStorage and after redirection can get access the same data in the other page from localStorage.
That is how I solved passing data between pages where we cannot use the query string option with offline cache manifest files.
When you don't have any network connection and want to access that page, it will fetch locally.