On met sur le 1er site :
<script type="text/javascript">
function resizeCrossDomainIframe(id, other_domain) {
var iframe = document.getElementById(id);
window.addEventListener('message', function(event) {
if (event.origin !== other_domain) return; // only accept messages from the specified domain
if (isNaN(event.data)) return; // only accept something which can be parsed as a number
var height = parseInt(event.data) + 32; // add some extra height to avoid scrollbar
iframe.height = height + "px";
}, false);
}
</script>
<iframe id="framence" src="http://localhost:3000/fr/etablissement/2/client/admission" style="width: 100%; border: none;" onload="resizeCrossDomainIframe('framence', 'http://site2');">
<p>Votre navigateur ne supporte pas l'élément iframe</p>
</iframe>
on mets sur le 2e site :
setInterval(function () {
parent.postMessage($('body').height(), 'http://site1');
}, 1000);