In my pdf, in my onOpenAction, I have this js code:
app.alert(this.hostContainer);
try {
this.hostContainer.postMessage(['Hello World']);
} catch(e) {app.alert(e.message);}
in my html, I have this code:
function messageFunc(messageArray) {
alert("In message Func:"+messageArray);
}
document.getElementById("pdfObject").messageHandler = { onMessage: messageFunc };
In Chrome and FF this works fine, one pdf alert showing a valid hostContainer, and a web browser alert showing the message, Hello World
In IE (11) I get the pdf alert, showing a valid hostContainer, but no browser alert. No alert saying there was an error.
What am I doing wrong?
Turns out, that the PDF needs to be loaded in IE before you can set a messageHandler, So I have done this:
This is working across all 3 browsers. Yea.