I am showing different domain website on iFrame window in my visualforce page. There is a button on that website "SAVE" (let's say). Once cx clicks on save button, I should notify too. How do I get this done?
Java developer said he will be sending using parent.postMessage
and I am using below sample to get it. but the problem is I am not using any kind of button from visualforce.
<apex:page standardController="Quote" Extensions="Quote_Iframe" sidebar="false">
<script>
if (window.addEventListener) {
window.addEventListener("message", handleMessage);
} else {
window.attachEvent("onmessage", handleMessage);
}
function handleMessage(event) {
console.log("Received a message from " + event.origin + ".");
var messageFromSender = event.data;
<!-- document.getElementById("{!$Component.hdnField}").value = "messageFromSender"; -->
console.log(messageFromSender);
}
</script>
<apex:form >
<apex:inputHidden id="hdnField" value="{!retValue}" />
<center><apex:commandButton value="Back to Quotes" action="{!back}"/></center>
<!--<apex:detail relatedList="true" title="true" inlineEdit="true"/> <br/>-->
<apex:iframe src="{!Url}" scrolling="true"/>
<center><apex:commandButton value="Back to Quotes" action="{!back}"/></center>
can anyone tell me how to get that value to Controller without using command button.. Thanks a ton.