0

コンテンツに応じて iframe の高さを動的に変更しようとしています。

ただし、最新バージョンの chrome では機能しません。

ドキュメントは'undefined'クロムにあります。

Firefox では問題なく動作します。

私は何を間違っていますか?

<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>
4

1 に答える 1