var iMaxLoop = 6;
var iIntervalId;
function BeginPageLoad() {
// Redirect the browser to another page while keeping focus.
location.href = "<%=Request.QueryString[“Path”] %>";
// Update progress meter every 1/2 second.
iIntervalId = window.setInterval("iLoopCounter=UpdateProgressMeter(iLoopCounter,iMaxLoop);", 500);
}
function UpdateProgressMeter(iCurrentLoopCounter, iMaximumLoops) {
var progressMeter = document.getElementById("ProgressMeter")
iCurrentLoopCounter += 1;
if (iCurrentLoopCounter <= iMaximumLoops) {
progressMeter.innerHTML += ".";
return iCurrentLoopCounter;
}
else {
progressMeter.innerHTML = "";
return 1;
}
}
function EndPageLoad() {
window.clearInterval(iIntervalId);
// Find the object that represents the progress meter.
var progressMeter = document.getElementById("ProgressMeter")
progressMeter.innerHTML = "Page Loaded - Now Transferring";
}
Above method call when page loaded completely.
<body onload="BeginPageLoad();" onunload="EndPageLoad();">
You can test the pre-loader is working fine or not simple run application like as,
http://localhost/Preloader/PreLoader.aspx?Path=http://www.Choicepk.com
Summary,
We avoid loading page ugly still or old style and don’t want to display the page before loading all javascirpt and Css files. Pre-loader help us to achieve these tasks.