Thursday, November 18, 2010

I'm not referring to preloading images, I want to preload an HTML page using JQuery.

I'm not referring to preloading images, I want to preload an HTML page using JQuery.

0 comments:

test

Ajax the content in then use as you wish:
var myPrefetchedPage;
$.ajax({
  url: "test.html",
  cache: false,
  success: function(html){
    myPrefetchedPage = html;
  }
})
myPrefetchedPage is now the full content - which can be injected into the current page (completely replacing the page if required.
If you are just trying to leverage caching as much as possible a hidden iFrame may work better. You can then use jQuery to cycle the iframe src to fetch multiple pages.

0 comments: