Pre-loading html web pages or non-flash web applications?

I believe most of you have heard of pre-loading images.

But is there anyone who knows how we can preload web pages?

For example, when we enter GMAIL, we will see a progress bar of the download.

How do we preload the html of web pages / web applications (not flash related) how does gmail do it?

Best wishes

+4
source share
4 answers

Due to the statelessness of the HTTP protocol, preloading web pages can be a daunting task. One way to achieve this would be to first send the minimum HTML code to the client, and then gradually expand the parts of the site using AJAX . During the execution of these AJAX requests, you may have several counters on the page that say the site is loading, but if you want to have real progress bars (like the one that uses GMail), things get even more complicated.

+1
source

Google uses AJAX queries on GMail, you can do the same with jQuery. If you want to replace all the code on the 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, and then replace the loading screen with a code request.

+1
source

Depends on what you want to achieve.

But, as a rule, you can load the (next?) Page into a hidden iframe.
- make it public when it becomes reasonable.

0
source

Source: https://habr.com/ru/post/1316071/


All Articles