Link to home
Start Free TrialLog in
Avatar of peddhapati
peddhapati

asked on

Please wait... JavaScript

Hi
  I would like to have a JavaScript that would open a intermediate window saying "Please Wait..." while loading the new window.

Note:
1. The solution has to work in both IE and Netscape
2. The requested window should remain in the background while you were able to see the small pop up window with this message.
3. Once the new window is loaded completly it should replace the old window and the poped up window should disappear.

Also, I would like to have the code in the source page or in a differnt file which is called from the source page.   Since I have no control over the links from the source page.

Thanks
Avatar of fritz_the_blank
fritz_the_blank
Flag of United States of America image

You could launch a pop-up window on the onLoad event, but I don't know of any event that triggers when the page finishes loading. Moreover, I think that the onLoad event fires only once the page has finished rendering. Alternatively, if you have a sense of how long the page takes, you could launch a window saying telling the user to wait and launch the main window in the background, but then you wouldn't really be able to close the first window because it would be considered as the parent window. I wonder if there might be some way to use the setTimeOut function to accomplish something like you're looking for...

http://developer.irt.org/script/timeout.htm

Fritz the Blank
ASKER CERTIFIED SOLUTION
Avatar of adowns
adowns

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nzjonboy
nzjonboy

almost what you want here http://www.dhtmlcentral.com/script/script.asp?id=17 only it doesn't display in a popup window, instead hides the content of the page until it is ready to display

nzjonboy
try this,

<div id=loadingmsg style="position:absolute; z-index:2; left:300; top:150; width:200; height:100; border-width:4; border-style:ridge; background-color:#eeeeee"><center><br><br><font face='Arial' Size=3><b>Please Wait.....</b></font><br><br></center></div>
<html>
<head>
<script>
  function hidemsg(){
    if (document.all)
      document.all.loadingmsg.style.visibility='hidden';
    if (document.layers)
      document.loadingmsg.visibility='hidden';
    if (document.getElementById)
      document.getElementById('loadingmsg').style.visibility='hidden';
  }
</script>
</head>
<body onload="setTimeout('hidemsg()',1000);">
  <P> welcome to this page </P>
</body>
</html>

the message will disappear one second after loading the page.
MSIE only
=========
load.html
=========
<script language="javascript">
wSplash = window.open("splash.html","splash","height=100px,width=200px,center=1");
if (wSplash.opener == null) wSplash.opener = window;

//MSIE only
document.onreadystatechange = checkit;
function checkit() {
     if (document.readyState == "complete") { wSplash.close(); wSplash = null; }
}

</script>
<html>
<head>
<title>Waiting</title>
</head>
<body style="margin:0px;" scroll="no">
<iframe src="http://www.cisco.com" height="100%" width="100%" frameborder="0" marginheight="0" marginwidth="0"></iframe>
</body>
</html>


splash.html
===========
<html>
<head>
<title>Splash Window</title>
</head>
<body style="text-align:center;font-family:Tahoma;font-size:10pt;">
<div>Loading...</div>
</body>
</html>
This question has been abandoned. I will make a recommendation to the moderators on its resolution in a week or so. I appreciate any comments that would help me to make a recommendation.
 
In the absence of responses, I may recommend DELETE unless it is clear to me that it has value as a PAQ. Silence = you don't care
 
ahosang
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ - NO REFUND
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
ahosang
EE Cleanup Volunteer
I recommend a split among adowns,  third, and  b1xml2. They put effort into the question and contributed meaningful content.

Fritz the Blank
Points split:

SpideyMod
Community Support Moderator @Experts Exchange

third, points for you at
https://www.experts-exchange.com/questions/20580413/points-for-third-re-various.html

b1xml2, points for you at
https://www.experts-exchange.com/questions/20580412/points-for-b1xml2-re-various.html