开发者

Preloading of html web page or non-flash web applications?

I believe that most o开发者_Python百科f 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


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.


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.


Try this:

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


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..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜