I've been attempting to dynamically adjust the height of an iframe based on its content, but I'm facing issues in the latest version of Chrome.
In Chrome, 'doc is undefined' error is showing up.
Surprisingly, everything works perfectly fine in Firefox.
I'm not sure what I'm doing wrong here. Can anyone help me figure this out?
<script>
$(function() {
$('#iframeid')
.load(
function() {
try {
var doc = this.contentDocument ? this.contentDocument
: this.contentWindow.document;
alert(doc);
} catch (e) {
alert(e.message);
}
});
});
</script>
<iframe frameborder="0" id="iframeid" src="iframesource2.html"
height="1px"> </iframe>