or Connect
AppleInsider › Forums › Software › Mac Software › Pop-up window data errors with Lion and Safari
New Posts  All Forums:Forum Nav:

Pop-up window data errors with Lion and Safari

post #1 of 2
Thread Starter 

I have a web-based application that uses pop-up windows to capture certain user changes. One example is the user changing the default number of hours to a new specific number. The problem is that with Safari on Lion, the data does not get returned to the website.

 

I have tested this function with Windows and IE, Firefox, Chrome, and Safari with no problem. I have tested it with my Macbook system running Snow Leopard and Safari, with no problem. I have tested it with my Macbook and Firefox with no problem. I've used the Firefox Firebug debugging tool with no errors found.

 

Debugging has proven that the data is being captured by the popup, and it is assigned to the returnValue. However, the website never receives that data - the object is empty. This error is happening with every popup I've tried in the system covering a wide range of uses.

 

The only thing I have found that fixes/masks the problem is turning on the Developer menu in Safari, and then starting Javascript debugging. In that mode the problem does not occur, but I can't find any errors to fix.

 

It seems as if there is some change in Lion that affects the security of popup windows and returned data, but an internet search turns up no similar complaints. I have been able to reproduce the error on 3 different Macs running Lion.

 

I have verified that pop-up windows are not blocked, and java and javascript are enabled.  I've also compared the settings on my system with the failing systems and find no Safari settings that make any difference. I've tried all the simple things like system reboots, safari resets, and cookie cleaning.

 

This post would be better located in a Safari group if there was one. I would appreciate any ideas or information that might help.  I am an experienced developer but relatively new to Mac's.

 

Here is the code that calls the popup and waits for the returned data :


if (window.showModalDialog)
     retVal = window.showModalDialog(templink, "name", "dialogWidth:275px;dialogHeight:350px");
else
     retVal = window.open(templink, "name", "height=350, width=275,toolbar=no, directories=no, status=no, menubar=no, scrollbars=no,resizable=no, modal=yes");
if (retVal == 'cancel')
     return;
else {
     frmnewhrs.lid.value = tempid;
     frmnewhrs.newhrs.value = retVal;
     frmnewhrs.submit(); }
 

This is the code in the popup that captures and sends the new data :

 

function preSaveCheck() {
var tempstr = document.getElementById("newhrs").value;
if (tempstr.length > 0) {
     window.returnValue = tempstr;
     window.close();}
}
 

Thanks, Dave


Edited by davemonahan - 5/2/12 at 8:33am
post #2 of 2

I am through the similar issue. I open a popup suing window.open in my asp .net application which is supposed to be compatible with iPad. Value has successfully been returned when I use IE, Chrome, FireFox and Safari (on PC with windows 7).

 

Unfortunately the same code fails in Safari when I access the application through iPad. On iPad domObject is prompted on new window open instead of prompting returned value on new window close.I will appreciate your help in this regard.

 

Below is the code.

 

Popup Window Code:

 

Quote:

<scripttype="text/javascript">

function closeIt(tempValue){

            window.returnValue = tempValue;

            window.close();

}

</script>

//HTML:

 <inputid="btnButton1"value="btnButton1"type="button"title="Press it to Close"onclick="closeIt('btnButton1');"/>

<br/>

<inputid="btnButton2"value="btnButton2"type="button"title="Press it to Close"onclick="closeIt('btnButton2');"/>

<br/>

<inputid="btnButton3"value="btnButton3"type="button"title="Press it to Close"onclick="closeIt('btnButton3');"/>

 

Parent Window:

Quote:

<script type="text/javascript">

 

function modalWin(){

//alert('clicked');

if(window.showModalDialog){

                retVal = window.showModalDialog("About.aspx","name","dialogWidth:255px;dialogHeight:250px");

                alert(retVal);

}

else{

                retVal = window.open('About.aspx','name','height=255,width=250,toolbar=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=no ,modal=yes');

                alert(retVal);

}

 

}

</script>

//HTML

<asp:Content ID="BodyContent" runat="server"ContentPlaceHolderID="MainContent">

<a title="Test New Popup" onclick="modalWin();">NewPopupfor all browsers.</a>.

</asp:Content

>

New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Mac Software
AppleInsider › Forums › Software › Mac Software › Pop-up window data errors with Lion and Safari