Reputation: 11
I am using iframes in aspx page.
2.In the Page2.aspx I have 2 iframes. iframe1 gets parameters from page1.aspx and it has controls and button.In the button click event of iframe1 I want to pass the values of iframe1 to iframe2.
3.If I change the control values in iframe1 and click the button in iframe1,iframe2 should get refreshed.
Any suggestions please.
Upvotes: 1
Views: 32
Reputation: 11916
You can use postMessage to pass information to an iframe:
1) in you receiver just add a listener:
window.addEventListener("message", receiveMessage, false);
function receiveMessage(event)
{
if (event.origin !== "http://example.org:8080")
return;
// ...
}
2) then in you sender
dstIframe.postMessage("Your message", "https://host.com");
You have to use give in parameter the host who send the message and check in the receiver if the host is the one you want to receive information from.
Upvotes: 1