Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have two applications A(parent window) and B(child window).
A is hosted in server A1 and B is hosted in server B1.
I need to select and fetch data from child and transfer it to parent on closing .
I am using Window.postMessage() but I am not getting the data in application.
All the servers are connected to network.

I am opening the site A through server name and B url through the ip address.

Below is the code for child window.

JavaScript
function CloseWindowLV(serialobjstr) {        
window.addEventListener('message', function (e) {
    alert('parent got (from ' + e.origin + '): ' + e.data);
}, false);

window.postMessage(
    serialobjstr,
    'http://ipaddress/NetViewer');
    self.close();
}

Below is the code for parent window

JavaScript
function ee1() {
    window.addEventListener('message', receiveMessage, false);
    function receiveMessage(event) {
        if (event.origin != 'B's address')
            return;
        alert(event.data);
    }
}

I am using javascript.
Any help would be appreciable..
Posted
Updated 3-Jul-13 5:13am
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900