templates/embed/embed.js
function postEmbedHeightToViewer() {
  var newHeight = document.getElementById('tabinterface').clientHeight;
  if (newHeight < MIN_IFRAME_HEIGHT) {
    console.log('embed height too small, reset height to 100px');
    newHeight = MIN_IFRAME_HEIGHT;
  }
  // Tell the viewer about the new size
  window.parent.postMessage({
    sentinel: 'amp',
    type: 'embed-size',
    height: newHeight
  }, '*');
}
function postEmbedHeightToViewer() {
  var newHeight = document.getElementById('tabinterface').clientHeight;
  if (newHeight < MIN_IFRAME_HEIGHT) {
    console.log('embed height too small, reset height to 100px');
    newHeight = MIN_IFRAME_HEIGHT;
  }
  // Tell the viewer about the new size
  window.parent.postMessage({
    sentinel: 'amp',
    type: 'embed-size',
    height: newHeight
  }, '*');
}
function postEmbedHeightToViewer ( ) { var newHeight = document . getElementById ( 'tabinterface' ) . clientHeight ; if ( newHeight < MIN_IFRAME_HEIGHT ) { console . log ( 'embed height too small, reset height to 100px' ) ; newHeight = MIN_IFRAME_HEIGHT ; } // Tell the viewer about the new size window . parent . postMessage ( { sentinel : 'amp' , type : 'embed-size' , height : newHeight } , '*' ) ; }
Post a message containing the document height to the amp-iframe to trigger the resize.
Post a message containing the document height to the amp - iframe to trigger the resize .