Resizing iframe from content

When you want to give both your advertisers and your users the best experience, you sometimes want to resize an iframe (and maybe also a surrounding div) from within the iframe’s content.

For instance – if you’ve booked a 728×90 in a 930×180 container, you might want to collapse the ad space to half of the original height.

The solution is simple – add this to your ad code

<script language="javascript">
if (window.frameElement) = "90px";
// if you also have a surrounding div:
if (window.frameElement.parentElement) = "90px";

Leave a Reply

Your email address will not be published.