ricardo
ricardo

Reputation: 621

popup applet does not render the second click in the window that calls

I´m developing for web using struts and one applet that I use that is called in jsp. when I click in the first time, the popup shows perfectly and when I click the second time in the button who calls the applet, my applet window does not render, show only the background. When I try F5 it works.

This problem occurs only in firefox. How I resolve this problem?

Here´s my onclick:

onClick="javascript:showPopupAssinatura('<c:url value="/jsp/servidor/tabletAssinaturaManuscrita.jsp"/>', 'PopupAjuda', 633, 349, 'status=0,scrollbars=0, resizable=no');"

Here´s my function showPopupAssinatura:

function showPopupAssinatura(mypage,myname,w,h,features) {
if(screen.width){
     var winl = (screen.width-w)/2;
     var wint = (screen.height-h)/2;
     }else{winl = 0;wint =0;}
     if (winl < 0) winl = 0;
     if (wint < 0) wint = 0;
     var settings = 'height=' + h + ',';
     settings += 'width=' + w + ',';
     settings += 'top=' + wint + ',';
     settings += 'left=' + winl + ',';
     settings += features;
     var target = "mppesga" + myname;
     win = window.open(mypage,target,settings);

     if (win != null) {
        win.window.focus();
 }
}

Upvotes: 0

Views: 603

Answers (1)

ricardo
ricardo

Reputation: 621

I resolved this problem using javascript method: showModalDialog !!!

function showPopupAssinatura(mypage,myname,w,h,features) {
if(screen.width){
     var winl = (screen.width-w)/2 - 66;
     var wint = (screen.height-h)/2 + 26;
     var navegador = navigator.appName.toLowerCase();

}else{winl = 0;wint =0;}

     if (winl < 0) winl = 0;
     if (wint < 0) wint = 0;

     var settings = 'height=' + h + ',';
     settings += 'width=' + w + ',';
     settings += 'top=' + wint + ',';
     settings += 'left=' + winl + ',';
     settings += features;
     var target = "mppesga" + myname;

     /** 

      * checking what browser is currently being used to make the action of  
      * visualize the popup. 
      */

     if(navegador.indexOf("netscape") != -1)
         win = window.showModalDialog(mypage,null,"dialogWidth:"+w+"; dialogHeight:"+(h+=6)+"; dialogTop:"+wint+"; dialogLeft:"+winl+"; resizable:no");
     else
         win = window.open(mypage,target,settings);

     if (win != null) {
        win.window.focus();
 }
}

This solution only works in firefox because in IE, the size is out of standard, So, I put condition for browser that´s use in the moment.

I hope that I can help someone if the same problem if this code. =]

Upvotes: 1

Related Questions