My iframe Code Link is http://example.org?pd=123
var currentHeight = $('.comments_holder').outerHeight();
var parent = window.parent;
var targetOrigin = "my parent site link";
if (parent && parent.postMessage) {
parent.postMessage(currentHeight, targetOrigin);
}
From this i need to pass the height of the div to the main site
And now i also want to pass another parameter to main site
var count = 123;
var parent = window.parent;
var targetOrigin = "my parent site link";
if (parent && parent.postMessage) {
parent.postMessage(count , targetOrigin);
}
And my code in main site i.e. single.php
of wordpress site
<script>
jQuery(document).ready(function($){
window.addEventListener('message', receiveMessage, false);
function receiveMessage(event)
{
what will if else condition here to get both the values
}
});
</script>
NOTE i cant check based on event.origin as the link are containing parameters
for eg example.com?pd=123
And this link could be changing