This version is old school.
Please find jQuery plugins on npm.
jQuery iframe auto height plugin
by Jesse House
The plugin will resize an iframe to the height of its contents. It will NOT work if the iframe contains a page from another domain. If using jquery 1.9 or up jquery.browser.js is also required.