views:

89

answers:

4

Hi all, I believe that most of you have heard of preloading of images.

But is there anyone who knows how we can preload webpages?

For instance, when we are login to GMAIL, we will see a loading progress bar.

How do we preload html webpages/web applications (non-flash based ) as per what gmail is doing?

best Regards

A: 

Try this:

http://www.gayadesign.com/diy/queryloader-preload-your-website-in-style/

quantumSoup
oh yes I have seen this. But what does it actually do?
DjangoRocks
hmm, http://www.gayadesign.com/diy/queryloader-preload-your-website-in-style/ didnt work for me. I think it has some bugs.
DjangoRocks
+1  A: 

Due to the stateless nature of the HTTP protocol, pre-loading webpages could be challenging. One way to achieve this would be to have a minimal HTML sent to the client initially and then progressively enhance parts of the site using AJAX. During the time those AJAX requests are being executed you could have some spinner on the page saying that the site is being loaded, but if you want to have real progress bars (such as the one GMail uses) things become even more challenging.

Darin Dimitrov
hmm, that's true. But i was wondering if you can give me an idea as to how we can do a AJAX preload? such as preloading a webpage or part of a webpage?
DjangoRocks
Darin Dimitrov
A: 

Google uses AJAX requests on GMail, you could do the same with jQuery. If you wanted to replace the entire code between on a page.

function preload(url2load,anyDataIfAny) {
    $.ajax({
      type: 'POST',
      url: url2load,
      data: anyDataIfAny,
      success: function(data) {
        $(html).html(data);
      }
    });
}

This will show the user the loading screen until the page is loaded, then replace the loading screen with the requesting code.

Robert
A: 

Depends alot on what you want to achieve..?

But generally, you could load the (next?) page into a hidden iframe.
- unveiling it when that becomes prudent..

T4NK3R