resize iframe auto


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( return; // only accept something which can be parsed as a number
var height = parseInt( + 32; // add some extra height to avoid scrollbar
iframe.height = height + "px";
}, false);

<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>

on mets sur le 2e site :
setInterval(function () {
parent.postMessage($('body').height(), 'http://site1');
}, 1000);