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
- it shows splash image. , @ same time try http://mysite/main
- wait 5 seconds
- if http://mysite/main ready, redirect it
- 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
Post a Comment