How to get the body's content of an iframe in

2018-12-31 04:56发布

<iframe id="id_description_iframe" class="rte-zone" height="200" frameborder="0" title="description">
  <html>
    <head></head>
    <body class="frameBody">
      test<br/>
    </body>
  </html>
</iframe>

What I want to get is:

test<br/>

8条回答
弹指情弦暗扣
2楼-- · 2018-12-31 05:22

use content in iframe with JS:

document.getElementById('id_iframe').contentWindow.document.write('content');
查看更多
还给你的自由
3楼-- · 2018-12-31 05:26

it works perfectly for me :

document.getElementById('iframe_id').contentWindow.document.body.innerHTML;
查看更多
登录 后发表回答