In liferay application, we have page loaded from actionurl. Once after page is loaded, in browser we are setting work offline.
If we copy the "actionurl" of the loaded page and tried accessing on another tab, still page is getting loaded. This page is getting loaded from cache. From developer tool, we could see page loaded with label "cached".
How to prevent this?.
setting browser.cache.disabled=true - is not working in the above case.
Try this, in portlet.xml under portlet-class and init-param add:
<expiration-cache>0</expiration-cache>
This would set a cache that is always expired.
Related
I've written an Firefox extension to inject some script and css to all web pages loaded while this extension is installed.
Up to now, everything works fine. As soon I open a new page it loads en the script and css are injected. But what I want is that the extension is loaded before the page.
Example; I'm loading the twitter intent page. With my extension I'm customising this page. Right now I first see the twitter page, then the extension is loaded and my changes to the intent page are implemented.
What I want is the opposite. I first want to load everything from the extension, so as soon as the twitter page loads it is directly visible with my custom changes implemented trough my extension.
Currently I'm using the following lines to implement the scripts/styles. Although I've got the "contentScriptWhen" set to start, this won't fix my problem..
include: '*',
contentScriptFile: [data.url('jq.js'), data.url('js.js')],
contentStyleFile: data.url("css.css"),
contentScriptWhen: 'start',
I've 'solved' this problem. I'm loading the Twitter Intent (TI) page in the background as soon my index page is loaded.
While the TI page is loaded, it closes again. The page is in cache now, next time TI is loaded everything is instant correctly.
You can find more about background loading here: developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/tabs
In this fiddle is shown how I did the trick; FIDDLE
You can also start by preventing the document from getting parsed then on the side fetch the same document, make any modifications on the fetched document and inject it in the page. Here is what I currently use https://stackoverflow.com/a/36097573/6085033
I am looking for a firefox plugin that can store entire page in cache and load it when ever that address is typed, and only load content from server if we press reload cache or similar functionality.
My usecase is, I use documentation of Laravel, Bootstrap, Jquery etc on regularly based but each time I am accessing it from the internet, these pages do not have any changes for many days. I dont want to store the webpage as file and access it, I would love to do it in comfort of your web browser than opening files.
I think firefox already does this. Load a page in a tab, then go to top left firefox menu > developer > work offline.
Reload that page in tab its from cache.
If you ever go work offline it loads from cache.
This is basically identical to this SO questions which has not been answered: Offline Web App not caching on Firefox but ok on Chrome
I'm experiencing the same problem and I'll provide a bit more information because it might help someone trying to figure out the arcane mysteries and traps of trying to implement cache manifest.
The problem: hit page reload/refresh and the page should reload from the offline cache, but it doesn't.
It works fine in Chrome 23: when I disconnect from the internet and refresh the page, it loads fine and the console shows Application Cache NoUpdate event.
However, Firefox 15.0.1 shows me my 404 page.
Troubleshooting (Firefox): Go to Firebug and click on DOM, then applicationCache. The status shows 0, which means uncached (the page has not been stored offline).
Troubleshooting (Firefox): Go to Firefox Options -> Advanced and look at Offline Web Content and User Data. It shows that my domain is using 1.4MB of data for offline use. (This is a good place to check for whether your page has been cached).
Troubleshooting (Firefox): Open a new tab and go to about:cache. Here you should see a heading for Offline cache device. Here you can see the Cache Directory, which is where your offline cache files are saved. If you click on List Cache Entries you'll see the files in your offline cache manifest.
There are 2 things that I find strange here: 1) is that when I click on any of the files on the list it goes to a blank page that says "Cache entry information The cache entry you selected is not available." However, the files do exist and are not blank in the Cache Directory 2) Although all of the files from the cache manifest are listed, the page that I'm calling is not listed here (in Chrome DevTools it shows up in the manifest as Master: it is cached automatically even though it's not explicitly listed in the cache manifest file).
Here's what I see when I'm online: With a cold (empty) cache, when I load the page the console shows the checking, downloading, progress, and cached events, but the cache status is uncached. Basically, the cache files are downloaded, but they cannot be accessed. Firebug DOM applicationCache says: 0 items in offline cache (this contradicts what is shown in about:cache and Options -> Advanced). The status is 1, which means idle. When I look at the Net tab in Firebug when online, it shows a GET request for the page with a 200 OK response. The Expires setting shows Wed Dec 31 1969, which I think means that the page will always be fetched. The other files show a 304 Not Modified response, which means they are being loaded from the browser cache, not the offline cache (the analogous response from Chrome for these files is 200 OK (from cache), which means they are loaded from the offline cache, not the browser cache).
When I'm offline: With the "uncached" cache the GET request fails and it loads the offline fallback 404 page with a 200 OK (BFCache) response.
It seems the offline cache is downloaded because it physically exists on disk and progress events are shown in the console, but Firefox never fires the cached event, so some of the resources have not downloaded successfully. The files are all png, js, or php format, so no crazy file formats. Chrome downloads the exact same files into the cache without a problem. I've also tried mobile Safari and it successfully reloads the page from the offline cache.
Are there any known issues with Firefox not caching certain file types? I use the .html.php extension on some of my files. I also generate the manifest dynamically using a php file, so it is only getting files that exist and it hashes them to detect changes and update the manifest.
Next Steps: I will try a bare-bones manifest to see if I can get it to work, then add files one by one to see which file triggers the error. Perhaps Firefox doesn't like the fact that I'm dynamically generating the cache manifest instead of manually updating a static file?
I've learned a lot about the arcane intricacies of cache manifest, but I'm more of a hacker than a computer expert. Has anyone else experienced this quirkiness with Firefox?
The beginning of the page:
<!DOCTYPE html>
<html manifest="/directory/manifest.php">
and then the manifest.php is just
header('Content-Type: text/cache-manifest');
echo "CACHE MANIFEST\n";
etc. etc. It uses RecursiveDirectoryIterator to get all the files in the directory (except the cache itself, which is included by default).
I've been at this for a few days now and am becoming more and more frustrated. I'm getting inconsistent offline functionality results across Chrome, FF, and I've just started using Safari.
I'm developing a sandbox app using Asp .Net MVC 3. Below is the structure of my application:
Controllers/CarController
Views/Car/Edit
Views/Car/EditOffline
Views/Car/Index
Out of the 3 views, Index is the only that has the manifest attribute defined. Index is the view that is initially requested. Below is the contents of my manifest:
CACHE MANIFEST
FALLBACK:
Car/Edit Car/EditOffline
#Version 1
Upon the first request of Index, the browser creates 3 entries in the Application Cache. They are:
localhost/Sandbox/Car, type = master
localhost/Sandbox/Car/EditOffline, type = fallback
localhost/Sandbox/Offline., type = manifest
The way I've been simulating offline behavior for all 3 browsers is by explicitly stopping IIS. After, Index has been requested. I shut down IIS and make a request to the Edit action. The result is is EditOffline gets served up. Now, when I the Index view again, I get a 404 error, but why? I thought the browser would've have served up the cached version of that page? When I re-requeset the Edit view (while still offline), I also get a 404 error, but why? The browser served the EditOffline view previously so why do I get a 404 now? In FF, I've gotten it to work as expected a few times, but I made no code changes. I explicitly deleted the offline cache, restarted the server, re-requested the index view and it magically worked.
It looks like your initial request is for http://localhost/Sandbox/Car, is that the URL you then get a 404 on? The manifest works by URL but it knows nothing about default pages or any other server configuration. So http://localhost/Sandbox/Car is a different page to http://localhost/Sandbox/Car/Index as far as the application cache is concerned. The view involved is largely irrelevant to the caching other than that you've included a reference to the manifest file in it.
I'm doing some work with html 5's offline application cache using firefox 3.6. My web application uses iframes to load other web application that pass the same-origin policy requirement. Unfortunately, the offline application cache for the iframe loaded page does not work. Specifically:
For the url sourced in via an iframe, I observe the application manifest and all of resources listed inside of it being loaded from my webserver.
When I load the url of the iframe directly by typing it into my URL bar, the application cache works.
When the page that has the application cache is loaded via an iframe, the application cache does not work.
The only difference between the container page url and the iframe src url is the web application context (i.e. container is 'https://www.example.com/cat' while iframe source url is 'https://www.example.com/dog').
I did find some chatter on a whatwg working group thread discussing whether iframe's should inherit container manifest settings, which leads me to believe that this ought to work.
Am I doing something unreasomnable? Is firefox lagging behind the whatwg specification? Any ideas or pointers to a solution would be appreciated.
I figured out the problem and filed a bug ticket with firefox:
https://bugzilla.mozilla.org/show_bug.cgi?id=623996