Link to home
Start Free TrialLog in
Avatar of VapiSoft
VapiSoft

asked on

IE Error after openening a child window

Hi,

I am using JavaScript window.open to open a child-window.
In the child-window, I use arrays from the parent window like that:
var objects=window.opener.objects;
After I close the child window, when I use this array I get the following error:
The callee (server [not server application]) is not available and disappeared; all connections are invalid. The call did not execute.
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Please show more code.

The open and the function and where the function is called
Avatar of VapiSoft
VapiSoft

ASKER

I cannot send the whole code because it is very very large and it has many files.
But the code of the child-window is combined of a php file and a (main) js file.
 
var users_names=window.opener.users_names;
var users_data =window.opener.users_data;
var objects    =window.opener.objects;
var removed_users=window.opener.removed_users;
var my_notify_bits=0;

var space=' ';
var show_pictures2;
var att_game, att_team1, att_team2, the_team, att_list, n_att;
var my_group, other_user;
var is_child_window=1;

function open_att(vars,user)
{
 var v=vars.split('_');
 i_user=user;
 is_att=1;
 show_pictures2=true;
 from_attend=true;
 from_log=0;
 
 init_dictionary();
 var obj=getobj('main');
 translatePage(obj);
 
 att_game  =v[0];
 att_team1 =v[1];
 att_team2 =v[2];
 the_team  =v[3];
 var time  =v[4];
 att_list  =v[5];
 other_user=v[6];
 	  
 from_user=0;
 next_user=0;
 my_notify_bits=0x8000; // show pictures;
 
 fans_item=the_team;
 fans_users="";
 n_att=0;
 
 var obj=getobj('the_game');
 obj.innerHTML=objects[att_game][1].replace(/<br>/,' ');
 obj.style.fontSize="16px"
 set_obj_color(obj,"red","bold");

 var obj=getobj('the_pair0');
 obj.style.fontSize="16px"
 set_obj_color(obj,"red","bold");

 var str="";
 if (time)  
 {
  str='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="YellowGreen">['+get_expiration(time)+']</font>';
 }
 var obj=getobj('the_pair1');
 obj.innerHTML=objects[att_team1][1]+' <img src="../Images/Icons/rightleft_16.png" align="center"/> '+objects[att_team2][1]+str;
 obj.style.fontSize="16px"
 set_obj_color(obj,"blue","bold");

 var obj=getobj('title');
 obj.style.fontSize="16px"
 set_obj_color(obj,"green","bold");
 
 open_att1(0);
}

function open_att1(only_att)
{ 
 if (only_att) only_att=1; else only_att=0;
 users_status=new Array();
 
 var obj=getobj('fans_list');
 obj.innerHTML="";
 
 var get_me=1;
 if (other_user) get_me=get_me;
 var  index=post_to_php('^get_fans_status.php?att=1&users=&only_att='+only_att+'&object='+the_team+'&get_me='+get_me+'&n_lines='+n_users_per_page+'&removed='+removed_users+'&log=0&next=0');
 ajax[index].onCompletion =  function() { reply_get_fans_status(index,2); };
 ajax[index].runAJAX();
} 
 
function reply_leag_add_att(index)
{
 var  data_str=debug_alert(ajax[index].response);
 if (!data_str) return;
 var data=json_decode(data_str);
 
 for (var i in data)
 {
  the_team =i;
  fans_item=i;
  window.opener.setObject(i,data[i]);
 }
 window.opener.change_att(att_game,att_list,att_team1,att_team2,n_att,fans_item);
 
 show_users();
}

function get_user_link(user)
{
 var  user_name=users_names[user];
 if (!user_name) return '';
 if (!users_data[user]) return user_name;
 var fbid=users_data[user][0];
 return '<a href="http://www.facebook.com/profile.php?id='+fbid+' target="_blank">'+user_name+'</a>';
}


function get_expiration(time1)
{
 var time=time1;
 var now=new Date().getTime();
 time/=60;
 now/=60000;
 var diff=parseInt(now-time);
 var before=false;
 if (diff < 0)
 {
  before=true;
  diff=-diff;
 }
 var date0='';
 
 if  (diff < 60*24*60)
 {
  if (diff < 60)    {a1=diff;                   a2=minutes;}
  else
  if (diff < 24*60) {a1=parseInt(diff/60);      a2=hours;}
  else
                    {a1=parseInt(diff/(24*60)); a2=days;}

  if (before)
  {
   date0=get_in_time.replace(/\*1/,a1).replace(/\*2/,a2);
  }
  else
  {
   date0=get_time_ago.replace(/\*1/,a1).replace(/\*2/,a2);
  }
 } 

 var e=new Date(time1*1000);
 var day=e.getDay();

 return tt1(window.opener.week_days[day])+'&nbsp;&nbsp;'+date0;
}

function jQgridHandler(obj,column){}
function clickGridRow(obj,rowid){}

function show_att_header()
{ 
 var status=users_status[the_team+'_'+i_user];
 
 var show="none"
 if (!status)
 {
  var show='';
  var obj=getobj('add_comment');
  obj.innerHTML=roll(0,'add_comment()','comment_add.png','',0)+space+tt1("Add new comment.");
  obj.style.fontSize="16px"
  set_obj_color(obj,"red","bold");
 }
 var obj=getobj('new_user_comment');
 obj.style.display=show;
 var text=tt1('I will attend the game.');
 
 if (status && (status[5] > 0))
 {
  var text='<img src="../Images/Icons/check.png"/>'+text;
 }
 else
 {
  var text=roll(0,'add_me()','../Icons/plus.png','',0)+' <font size="3"><b><a href="javascript:add_me()">'+text+'</a></b></font>';
 }
 var obj=getobj('add_me');
 obj.innerHTML=text;
 obj.style.fontSize="16px"
 set_obj_color(obj,"YellowGreen","bold");
}

function add_me()
{
 var text=tt1("I will attend the game.");
 set_comment(text,1,2);
}


function remove_my_comment()
{
 var  index=post_to_php('^rem_attend.php?object='+the_team);
 ajax[index].onCompletion =  function() { reply_rem_attend(index); };
 ajax[index].runAJAX(); 
 
 users_status=extract_array4(users_status,the_team+'_'+i_user);
 show_att_header();
 from_log=0;
 show_fans();
}

function reply_rem_attend(index)
{
 var  data_str=debug_alert(ajax[index].response);
}

function add_comment()
{
 var obj=getobj('add');
 obj.style.display="";
}

Open in new window

Don't assign the opener objects to child vars.

Operate on them in the opener.

The problem is that I want to use the data from the opener window, and that I want to store the data that I get from the server via AJAX in the opener window so I will have them in the next time that I open this window.
I know it can be done because it works and because other experts told me to do it.
Just KEEP them in the opener and use getters and setters
I don't understand how to do (how to get data from the opener or set data in the opener)?
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

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
Thanks.
It solved the problem.