Iframe ReturnValue returns undefined if domains are not the same

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:ye­s;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.innerT­ext;
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>
 
J

Joe Fawcett

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.

If the domains are completely different I don't think it can be done with
changing the "access data sources across domains" in the security settings, and
even then it may not work.
If the domains are as you wrote then you can set the document.domain property if
you can alter the page source.

http://msdn.microsoft.com/library/d...ml/reference/properties/domain.asp?frame=true
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top