Using HTML's Application Cache without caching the current page itself? - html

My page references a lot of PDF's. If the user loses connection to the Internet or their network, which unfortunately seems to happen quite a bit for our users in the middle of nowhere, I would still like them to be able to access the PDF's.
Using the Application Cache mostly works, except that it also caches the current page itself, and I can't figure out how to get it not to do that. The page itself changes frequently so I don't want it to cache. I know I can find out if it has changed, but that just means I have to refresh the page after they're already using it, which is not ideal.
So is there any way to NOT have the current page cache, but have everything else in my manifest file be cached?
I tried several different things without success. I added an iframe, which did seem to cache the PDFs, but when I went offline my current page did not access them from the cache (because the browser didn't know to grab it from the cache I would guess, I just know it didn't work). I also tried adding the current page to the NETWORK section of the manifest, so it wouldn't be cached, but it didn't work (it was still cached).
Am I missing something? Is there a better alternative for what I want?

It works without the "download" attribute on the anchor tag.
If anyone else has the same problem, the iframe solution does work (where you add a hidden iframe to the page, and the iframe is pointed to a page that has a manifest file for everything you need). It just doesn't work if you have a download attribute on your anchor tag.
That's about 3 hours I'll never get back...

Related

How to force HTML Page Refresh from Server

Currently, I am facing an issue with HTML page. So here if a user visited the site then the browser is caching the entire HTML page. So when the user hits the URL again then the browser taking that HTML from the cache instead of calling/requesting to the server for HTML contents. Here our Team member forgot to add meta tags which would force the browser to take content from Server each time. Is there any way that we could resolve the issue? Since the page request itself not reaching the server so User will not see the refresh contents of the website. If user do Ctrl+F5 then they can see updated contents. I went through many sites and stack overflow questions but I did find a solution for forcing HTML page to load contents from server using meta tags.But existing users is there any resolution that we could apply?
Problem is here the page did not call server to get contents it just loads from cache.
There's nothing you can do.
You've previously instructed the browser to cache the file (presumably for a long time) and not check for updates (via ETags or If-Modified-Since) so it is going to use the cached version until its cache expires (from the user intervening or automatically (which might be sooner than your caching instructions said)).
There's no way to provide new caching instructions to the browser without it requesting them from the server (which it won't do because of the existing rules).

HTML and CSS doesn't update online due to browser caching

I run a website for a small company. The websites mostly contains text and images. Whenever i update the website by replacing a image or updating the css, it doesn't get updated on other people's browsers because it's been cached. I've found a way to get around this by adding a version number where i'm linking my stylesheet, however, this doesn't apply to images. What is the most simple way to get around this?
I've done a lot of research on the web and on stackoverflow, but they are all complicated solutions. There must be a better way.
Just to be clear, i know i can clear the cache in my browser. I'm looking for a solution that works for everyone who access my website.
You can add these meta tags and it will force a page to reload from the server on every reload. However, you should realize that this could result in a lot more data usage for both you and your users.
<meta http-equiv=“Pragma” content=”no-cache”>
<meta http-equiv=“Expires” content=”-1″>
<meta http-equiv=“CACHE-CONTROL” content=”NO-CACHE”>
If you have a reload link or button on your html page, you can add this attribute to it to force a reload from the server. The 'true' parameter is what forces a full reload instead of a cache reload.
onClick="location.reload(true);"
You can rename your images (preferably) automatically when you want to avoid them being cached, adding a version number to their name. If you have something which does this automatically, then you bypass the problem of caching them.
If you want to keep the name of your images, then you can make the change only temporary.
Try versioning(?version) to the files to avoid browser caching.
it will be like filename.jpg?v1 filename.jpg?v2
Or if you are replacing files frequently try adding current timestamp for every page load
In php,
filename.jpg?<?= time()?>"
where time() is current timestamp
This means you are just changing the urls everytime.

Website Messed Up Only If Accessed In Past

So my website: ropinranch.com
looks FINE on any browser (so far) if you haven't accessed the page in the past. But for any of my previous users, it looks messed up when they load it.
We've all cleared all of our cookies, and emptied our cache. I even edited a new image on the page to see if that would change and it DID.
I cannot think any other way the page would be keeping memory of it.
One of my testers said that if they had the page bookmarked in the past of it working fine, that when clicking on the bookmark it loads fine still -- but typing in a URL fails.
Any other ideas on what I'm missing here?
Update: I realized what happened -- but I'm unsure how to fix.
https://ropinranch.com WORKS
but
www.ropinranch.com does not. I know theres a setting in my c-pannel to change this but I don't know what it's called
Try ctrl+F5 to reload the page without caching.
This helped me temporarily:
By Varun: If you are just testing, could you try passing a timestamp or random number in the URL ( manually , just for testing ) and check. Eg : http://ropinranch.com?f=141414542343 (each time with a diff number )
But What I did was I had to go through the server and reroute all traffic to my SSL site rather than things of www. or http://

Use chrome extension to trick page into thinking it's not in an iFrame

Is there a way to create a Chrome extension to trick a site loaded in an iFrame into thinking it's not in a frame?
We load clients' sites into an iframe for demos, but some resources get blocked due to them disallowing being loaded in an iFrame. We'd like to load these sites into a frame as though you were browsing directly to the site in a standalone tab.
You should use the Chrome's webRequest in order to intercept the server response. See the API. Here you go for onHeadersReceived event where you are in control of any response headers => you need to remove X-Frame-Options header from the response.
That's pretty much it, if this is the only problem in loading those sites.
However, for the sake of completeness, in order to fully trick the browser (which you most likely do not need) you need also to inject a script into every page that would clear up some things like window.parent by simple removing them from window object and some other things like origin etc. However removing the header would work for 99.9999% of your use cases.

Microsoft Windows and IE not handling images (favicons too)

I've read the SO posts regarding this and can not find a solution.
I've tried changing the link in the HTML to another location. I've tried clearing all the browser data. But, it still pulls a previous favicon.ico.
Does anyone know where it is getting this old favicon.ico? I should be able to delete it manually at a minimum.
This site process does not work.
http://www.phpjunkyard.com/tutorials/force-favicon-refresh.php
Actually answer might be here:
How to clear IE's favicon cache?
This is wrong too...clearing the browsing history and cache..does nothing to the favicon.ico file
O.K...there was a check box you have to de-select to keep it from saving favorites...this was not intuitive b.c. you have to select all the rest.
From there I changed the file name and link to in the HTML.
Then I waited about a day
Then it changed....I.E has some sort of timer..can anyone quantify this delay for it to pick up changes?
I've recently noticed that Windows 7 does not update images, that is if I save and image over and exiting image...windows will still display the old image until I click on it. Probably related in some way to Microsoft's philosophy on updating images