1

I am developing a webapp that is fully utilizing HTML5 Offline/Application Cache, which works really well except for one sticking point...

I use the $.load() function to load content when switching between pages. The files I'm loading are files on the same server, however because $.load uses $.ajax internally, these files are not fetched from the AppCache (the call simply fails).

var newPage = $('#slider').append('<div id="'+name+'">');
$('#'+name).load(someurl, function() {
    // Display the loaded content

(Note: someurl represents a file that does already exist in the AppCache, but just isn't loaded using the above code)

Does anyone know of an alternative to $.load that I can use to read .html files that contain javascript that will work when offline?

Ideally, this would be a simply drop in replacement for $.load, to load content from one file into a node.

0

1 Answer 1

2

Try setting cache to true in ajax settings.

var newPage = $('#slider').append('<div id="'+name+'">');
$.ajaxSetup( {cache:true});
$('#'+name).load(someurl, function() {
    // Display the loaded content

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.