By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,018 Members | 870 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,018 IT Pros & Developers. It's quick & easy.

Auto refresh of child window on its current state

P: 1
Folks,

I want to refresh my child window after a particular interval of time, its working with the following code, but after getting refresh its always forward me on first URL not on the current state of the child site. Below is the code for your reference.

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  
  3. <script>
  4.  
  5.  var limit="0:10";
  6.  var childWindow = null;
  7.  
  8.  if (document.images){
  9.  var parselimit=limit.split(":");
  10.  
  11.  parselimit=parselimit[0]*60+parselimit[1]*1;
  12.  }
  13.  
  14.  function beginrefresh(){
  15.  if (!document.images)
  16.  return;
  17.  
  18.  if (parselimit==1){
  19.      window.location.reload();
  20.      alert('1');
  21.     newwin();
  22.      }
  23.  else{
  24.          parselimit-=1;
  25.          curmin=Math.floor(parselimit/60);
  26.          cursec=parselimit%60;
  27.      if (curmin!=0)
  28.          curtime=curmin+" minutes and "+cursec+" seconds left until page refresh!";
  29.      else
  30.          curtime=cursec+" seconds left until page refresh!";
  31.     window.status=curtime;
  32.      setTimeout("beginrefresh()",1000);
  33.  }
  34.  }
  35.  
  36.  
  37.  function newwin()
  38.  {
  39.  
  40.     if(childWindow ==null){
  41.     childWindow = window.open('http://www.hsbc.co.in','Childwindow','status=0,toolbar=0,menubar=0,resizable=0,scrollbars=1,top=50 ,left=50,height=375,width=650');
  42.     }
  43.  
  44.  
  45.  }
  46.  
  47. function checkChildURL(windowObject) {
  48.   var url = "error";
  49.   try {
  50.    url  = windowObject.location.href;
  51.   } catch(e) {
  52.   // we don't actually catch anything, we just want to stop the error from throwing
  53.   }
  54.  alert(url);
  55. }
  56.  
  57.  
  58.  
  59. window.onload=beginrefresh
  60.  
  61.  </script>
  62. </html>
Sep 20 '07 #1
Share this Question
Share on Google+
2 Replies


dmjpro
100+
P: 2,476
Welcome to TSDN.
Use Code Tags while you do Post.
If you want to refresh the child window then try this.

Expand|Select|Wrap|Line Numbers
  1. childWindow.location.reload();
  2.  
Good Luck.

Kind regards,
Dmjpro.
Sep 20 '07 #2

pbmods
Expert 5K+
P: 5,821
Heya, Ajain. Welcome to TSDN!

Please use CODE tags when posting source code:

[CODE=javascript]
JavaScript code goes here.
[/CODE]
Sep 20 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.