javascript - Redirect to a page when it's ready -


the main page, http://mysite/main, of site slow sometimes, want create index.html html page following

  1. it shows splash image. , @ same time try http://mysite/main
  2. wait 5 seconds
  3. if http://mysite/main ready, redirect it
  4. otherwise wait till http://mysite/main ready.

how implement function? should use jquery or simple iframe/js?

using jquery :

what can index.html have 2 panel / div :

1) loading page

2) actual content http://mysite/main

and in jquery show 1st panel .show() until .ready() executed hide 1st panel , show 2nd panel.

$("#first").show(); $("#second").load("http://mysite/main", function(){  settimeout( jquery( document ).ready(function( $ ) {     $("#first").hide();     $("#second").show();    }),300000); }); 

it better use loading icon per http://smallenvelop.com/display-loading-icon-page-loads-completely/


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -