javascript - iframe dynamic height doesn't work -



javascript - iframe dynamic height doesn't work -

i created little widget php file contains html ajax based form. form's height depends on output of ajax response text. therefore, need alter height dynamically. tried code , works on localhost file. code works:

<iframe src="ajax/cfw.php" id="idiframe" width="400px" onload="iframeloaded()" style="border: none;"></iframe> <script type="text/javascript"> function iframeloaded() { var iframeid = document.getelementbyid('idiframe'); if(iframeid) { // here can create height, delete first, create 1 time again iframeid.height = ""; iframeid.height = iframeid.contentwindow.document.body.scrollheight + "px"; } } </script>

however when seek iframe of exact file pointed on localhost doesn't hosted on localhost doesn't work:

<iframe src="http://website.com/ajax/cfw.php" id="idiframe" width="400px" onload="iframeloaded()" style="border: none;"></iframe>

why that, , how can prepare ? thanks.

javascript ajax iframe

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

ubuntu - Bash Script to Check That Files Are Being Created -