caching kills links (jquery mobile on iPad) - caching

I am working on a webapplication that uses caching to make it available offline. Everything works fine when running it chrome (offline and online). But when I run it on iPad the links don't work anymore and I get failed to load page everywhere. Removing the caching makes the links work again so it obviously has something to do with the caching. Navigating directly to the seperate pages of the webapp also works fine in Safari, its the link that causes the error. By default all links are loaded with AJAX in jQuery Mobile. Changing this by adding rel="external" also fixes the problem, but obviously I don't want to do that.
To enable caching I added this code: and created a manifest file with ALL the files (scripts, css, images, html). Does anyone know what the problem could be?

I've experienced this as well while working with caching using manifests. What I discovered was that there Chrome has no limits. iPad and iPhone do. This appears to be pretty small, around 5mb. Try removing images as much as possible and using YUI Compressor on your scripts.
Ajax requests can be cached actually, the system doesn't care if the request is by AJAX or normal full request. All you have to do is put the URLs you wanted to retrieve by ajax into the manifest like the rest of the assets.
Hope this helps

Related

Umbraco backoffice cache

I have a problem in my Umbraco backoffice, where alot of the clientside files are cached heavily, which is causing some problems.
All the files loaded, is from /umbraco/Application and contains references like;
"/umbraco/lib/jquery/jquery.min.js?cdv=1",
"/umbraco/lib/angular/1.1.5/angular.min.js?cdv=1",
"/umbraco/lib/underscore/underscore-min.js?cdv=1",
But, how can i change the cdv value? I tried to change it under /config/ClientDependency.config, but nothing happend (it is not the same value in the config file and in the output above).
So maybe the backoffice is using a different config file for ClientDependency? Or any other ideas?
On my Umbraco 7.4.1 installation, changing the version of clientDependency.config worked for me:
From:
<clientDependency version="1" fileDependencyExtensions=".js,.css" loggerType="Umbraco.Web.UI.CdfLogger, umbraco">
To:
<clientDependency version="2" fileDependencyExtensions=".js,.css" loggerType="Umbraco.Web.UI.CdfLogger, umbraco">
After the change, the script files were being called as:
/umbraco/lib/jquery/jquery.min.js?cdv=2
/umbraco/lib/angular/1.1.5/angular.min.js?cdv=2
/umbraco/lib/underscore/underscore-min.js?cdv=2
Etc.
If it's only your browser with this issue (rather than a clients whose you don't have access to), then you can just force your browser to load new version of HTML, CSS and JS rather than using the internal HTTP cache.
How to tell if you're loading cached resources
You will know if your browser has cached the resources by looking at the Network tab in your browsers Dev Tools. If resources are being loaded with a 304 rather than a 200, they have been loaded from the internal cache.
Forcing reload on Chrome
There is a SO post here which tells us the difference between each reload option.
General browser shortcuts
There is also a bit of information here about how you can use a keyboard shortcut to force a hard refresh on your browser.
Plugins
Clear Site Cache has worked quite well as a browser plugin for Firefox for me.

GWT URLs with # doesn't work with IE7

There seem to be a know issue with IE which doesn't respond to URLs that have # sign in them.
See for example: https://mootools.lighthouseapp.com/projects/2706/tickets/638-request-fails-when-url-has-hash-in-ie7
As we use # quite frequently in out GWT based application we are lacking support for IE7 users who want to browse the site.
Is there any known workaround for GWT other than modifying the URL?
History works perfectly well in our GWT app in all IE versions...
That ticket was about XMLHttpRequest, so do not use hashes in your xmlhttprequests. It has nothing to do with GWT.
First of all, the problem described in the supplied link is related with URLs that you query with XMLHttpRequest. In GWT application # can appear in ordinary GET request (when you are opening the page, that is when you are starting your GWT application). When GWT does XMLHttpRequest request, it uses URLs similar to:
http://yourserver.com/context/com.yourcompany.SomeModule/someService
There is no # in it, so if you have any problems, they are not related with this issue.
I think I finally figured out what the problem is.
Our gwt application is sitting as an iframe inside another HTML file so setting the gwt history support
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
has to be done in the outer HTML rather than the gwt one.
This gwt script was meant to support browsers such as IE6 and IE7 which don't have the onhashchange event implemented.

IE6 cannot download javascript files over HTTPS

I'm totally stumped here, so any ideas would be appreciated.
I have a RichFaces application, which recently became non-functional when used from IE6. The problem began when I included the following line in my main template:
<a4j:loadScript src="resource://jquery.js"/>
This results in the following generated HTML:
<script src="/AgriShare/a4j/g/3_3_3.Finaljquery.js.jsf" type="text/javascript"></script>
By "non-functional" I mean that pages no longer load, b/c the first page appears to hang the browser for a long time, and then all references to jQuery say that the object was not defined. Eventually this appears to put IE6 in a state where further clicks do nothing.
After a lot of trial and error I have established the following:
The app still works in Chrome, Firefox and IE8
The app still works in IE6, if I switch to HTTP. So, the problem appears to be related to HTTPS, which I can't dispose of.
I further narrowed down the problem by trying to manually request 3_3_3.Finaljquery.js.jsf in IE6 address bar. It asks me if I want to save the file (so it can see it is there), but when I say 'Save', it hangs for about 5 seconds and then says:
Internet Explorer cannot download 3_3_3.Finaljquery.js.jsf from [host_name].
The connection with the server was reset.
Doing the same download over HTTP succeeds.
Gradually reducing the size of the file, I noticed that the download eventually succeeds over HTTPS, if I get the files size below ~ 110KB. There is no specific size it works at though. I tried the same trick with prototype.js and it worked at a different size value.
I can't trace the SSL session, b/c I cannot get access to the certificate's private key, so now I have absolutely no clue what to try next.
Any ideas would be greatly appreciated.
Try using Fiddler for debugging. It can handle SSL.
You might also want to consider hosting the server yourself and taking a look at the server log.
The problem was solved by turning off compression of javascript files in Web Cache.
Sounds like the problem might be related to this: http://support.microsoft.com/default.aspx?scid=kb;en-us;327286

How do I share Safari's NSURLCache store?

Background
I'm building an app that links recent
web pages you've visited together.
To do this, I need to get the HTML
for recent URLs using Cocoa.
Right now, I'm using an invisible
WebView to do this.
As I understand it, if the URL isn't
in the cache for my app, this is
hitting web servers.
What I want
The chances are high that the URL I'm grabbing has already been cached by Safari as the page has already been visited.
I want my app to check Safari's cache for the URL first. If it's there, it should just use this data. If not, it should hit the web server and store the page in my app's cache.
I don't really want to have to parse the cache.db file from Safari using sqlite3 - I've no idea if this format will stay the same. I'm after something simpler and more high level.
What I've tried
I know that you can set up your own NSURLCache using the method initWithMemoryCapacity:diskCapacity:diskPath: but I don't want to try pointing this to the Safari cache in case it screws up Safari by writing to it.
Is there an easy, high level way of sharing the Safari cache?
UPDATE
Aha. I've just realised there may be a way to do this I've been missing.
I could make a new instance of NSURLCache with initWithMemoryCapacity:diskCapacity:diskPath:, point it at the Safari cache, then specify a cache policy of NSURLRequestReturnCacheDataDontLoad for the URL Request when loading the page.
When this fails, I could just try and load the page as normal. I'll try this out and update the question when I know more.
To be honest, you just can't do this.
Firstly, I'm pretty certain -[NSURLCache initWithMemoryCapacity:diskCapacity:diskPath:] won't work as you expect. It will instead blow away the old cache file to create its own; potentially highly upsetting Safari.
Secondly NSURLCache is a composite cache. That is, it caches data first in memory, and then moves it out to disk at some point. So even if you could properly access Safari's cache file (which you can't) you'd only be able to access the older cached data; not the most recent.

Are there any diagnostics tools for troubleshooting content delivery with Opera Mini?

I have an application that I'm targeting a wide variety of devices and platforms. The application can render different HTML based upon the type of client. However due to the complexity of the application, it shares a considerable amount of JavaScript libraries that rely on a number of async and ajax method calls.
One of the targets for the application is Opera Mini. This "sort-of" works but it seems like sometimes when building up the specialized markup to send down to the Opera Mini JVM client it does not wait until the async calls are complete. Are there any techniques or tools to see what's going on with the Opera Server (not my application web server) Side processing of the page to determine what I can do to make this solid?
It would appear that after further investigation that the server side browser is fairly picky when it comes to CSS. I can't remember the exact problem, but as soon as I removed the stylesheet all content was displayed properly. At that point I slowly re-introduced the CSS and everythning came back online and worked as expected.
Your javascript will only be allowed a short time before it is aborted:
JavaScript running on the Mini server
will only run for a couple of seconds
before pausing, for resource
constraint reasons. This applies to
JavaScript run due to an event firing
e.g. onload, as well as code run
because of a user action.
~ http://dev.opera.com/articles/view/opera-mini-web-content-authoring-guidelines/#javascript
So the best would be to serve the least javascripty version of your site to the Opera Mini user-agent.
You can type server:source in the address bar once a page is loaded if you want to see the current DOM tree.
It's also possible to post that source to a script on your server using server:source?post=http://your.server.com/script. It will send three fields as a POST request: url, host and html. You can then make your script save it to a file.
(Answering an old question in case it helps someone.)

Resources