Closed thibauld closed 8 years ago
You can use the URL in e.currentTarget.window.document.location
to get the vote id:
window.addEventListener('message', function(e) {
var voteId = e.currentTarget.window.document.location.pathname.split('/')[3];
// ...
});
I use several cocorico iframe on one page. Each of these iframe emit messages with postMessage but I am unable to trace back which iFrame emitted which message if the message does not include the id of the vote (1 vote <-> 1 iframe). Unless I am mistaken, I did not see the id of the vote in the voteComplete nor voteSuccess MessageEvents.
My first idea would be to pass voteComplete_[voteId] as data but I am definitely not a JS expert :)