title: How to detect onscroll event on an iframe? the iframe's source is of the same domain of the page
body: <p>The plan is not to have a scroll bar to the iframe that I am adding to my page. So the idea to do it as I thought is to have a onscroll function.</p>
  
  <p>So whenever a user scrolls the iframe, I will call this function</p>
  
  <pre><code>function resizeIframe(obj) {
      obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
  }
  </code></pre>
  
  <p>But I do not know how to detect onscroll event inside an iframe. </p>
  
  <p>PS: the source of the iframe is of the same domain as the page.</p>
  
  <p>My iframe:</p>
  
  <pre><code>&lt;iframe id="externalIframe" scrolling="auto" frameborder="0" allowtransparency="true" style="width: 1240px; height: 489px; display:block" src="http://www.example.com/" onload="resizeIframe(this);" onscroll="resizeIframe(this);" onclick="resizeIframe(this)"&gt;&lt;/iframe&gt;
  </code></pre>