S
Silver Arrow
Iframe ReturnValue returns undefined if domains are not the same
I am using a modal window and an iFrame to try and pull a return value
back.
IMPORTANT : I am doing this across domains.
Main app: http://webSite1.domain.com/mainApplication
Other app call in ModalWindow:
http://webSite2.domain.com/mainApplication
I have the value returned from the modal window to the iFrame window
but I can not get the value returned to the parent window. The alert
in the parent window always returns undefined errors. Any help would
be much appreciated.
I call the modal window and wait for the return as such:
function LCC()
{
var aUrl = "http://.../IFrame.html";
sFeatures="dialogHeight:600px;dialogWidth:850px;resizable:yes;center:yes"
LCV = window.showModalDialog(aUrl,"",sFeatures);
alert(LCV);
}
</script>
Here is the iFrame:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<script>
function onunloadevent(){
parent.window.returnValue =
window.frames[0].aValue.innerText;
alert(window.returnValue);
}
</script>
<body onunload='onunloadevent();'>
<TABLE align='left' border='0'>
<TR>
<TD
align='center'><IFRAME frameborder='0'id="Frame1"
src="http://...../default.asp" Style="HEIGHT: 10in; WIDTH: 10in;
MARGIN=0" SCROLLING="no" ></IFRAME></TD>
</TR>
</table>
</body>
</html>
I am using a modal window and an iFrame to try and pull a return value
back.
IMPORTANT : I am doing this across domains.
Main app: http://webSite1.domain.com/mainApplication
Other app call in ModalWindow:
http://webSite2.domain.com/mainApplication
I have the value returned from the modal window to the iFrame window
but I can not get the value returned to the parent window. The alert
in the parent window always returns undefined errors. Any help would
be much appreciated.
I call the modal window and wait for the return as such:
function LCC()
{
var aUrl = "http://.../IFrame.html";
sFeatures="dialogHeight:600px;dialogWidth:850px;resizable:yes;center:yes"
LCV = window.showModalDialog(aUrl,"",sFeatures);
alert(LCV);
}
</script>
Here is the iFrame:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<script>
function onunloadevent(){
parent.window.returnValue =
window.frames[0].aValue.innerText;
alert(window.returnValue);
}
</script>
<body onunload='onunloadevent();'>
<TABLE align='left' border='0'>
<TR>
<TD
align='center'><IFRAME frameborder='0'id="Frame1"
src="http://...../default.asp" Style="HEIGHT: 10in; WIDTH: 10in;
MARGIN=0" SCROLLING="no" ></IFRAME></TD>
</TR>
</table>
</body>
</html>