-
January 6th, 2012, 03:34 PM
#1
rendeing a "loading" page while another page loads in background
I have a situation where I need to program a loading page that renders in the user's browser while another page loads in the background.
Suppose I have page1.aspx. The user clicks a button on the page which is suppose to eventually lead to page2.aspx rendering in the user's browser. But page2.aspx takes a long time to load. Therefore, what's needed is an intermediate page, called loading.aspx, that renders in the user's browser while page2.aspx loads behind the scenes. The loading.aspx page simply displays a message that says "your data is loading" and runs an animation. So essentially, the button on page1.aspx actually loads loading.aspx, and then in a separate thread, page2.aspx loads behind the scenes, and when ready, renders in the user's browser.
I'm not sure how to load page2.aspx WHILE loading.aspx is loaded and rendered in the user's browser. I'm not sure if loading.aspx can do the job of loading page2.aspx once its done rendering. Would it be able to do this while still displaying to the user the loading message and the animation? Can page1.aspx do both tasks? Rendering loading.aspx in the user's browser and also getting page2.aspx to load in the background?
BTW, I'm programming all this in C# codebehind using Response.Redirect(). I could program something in javascript, but I'd like to avoid programming AJAX requests as I am unfamiliar with that and I don't have time to learn and implement it.
Please help.
-
January 9th, 2012, 03:12 PM
#2
Re: rendeing a "loading" page while another page loads in background
Hmm, interesting question..
You see, Web pages are interpreted ( read and displayed line by line ) usually. I am thinking of an IFrame running the animation, or even a DIV that displays your animation. But I am not sure that even that would work, because as I said, Web browsers such IE, and so interpret web pages line by line. That is where web pages differ from programs which are fully compiled before showing the result. I may be wrong though..
Any other guru wants to take a stab at this??
-
January 11th, 2012, 03:56 PM
#3
Re: rendeing a "loading" page while another page loads in background
Don't know if this meets your need:
on page1.aspx:
Code:
var _newWindow = null;
function openWindow() {
_newWindow = window.open("page2.aspx");
_newWindow.blur();
window.focus();//we cannot minimize that window. so just bring our loading page in the front
document.getElementById('Loading').style.display = "block";
}
function hideDiv() {
document.getElementById('Loading').style.display = "none";
if ( _newWindow !== null
&& _newWindow !== undefined ) {
_newWindow.focus();
}
}
<input type="button" id="hiddenButton" onclick="hideDiv()" style="display:none" />
<div id="Loading" style="display:none" >
Loading ...
</div>
on page2.aspx:
Code:
<header>
<script type="text/javascript">
function onLoad() {
if (window.opener !== null && window.opener !== undefined) {
window.opener.document.getElementById("hiddenButton").click();
}
}
</script>
</header>
<body onload="onLoad();" >
Last edited by Silent Sojourner; January 11th, 2012 at 04:03 PM.
Reason: correct mistakes
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|