最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Capture screenshot of iframe - html2canvas not working - Stack Overflow

programmeradmin1浏览0评论

I have the following iframe:

<iframe name="content" src="" style="position: absolute; left: 0px; top: 28px;" allowtransparency="true" border="0" scrolling="yes" width="100%" frameborder="0" height="90%" id="MyFrame"></iframe>

I simply want to capture a screenshot of the iframe contents as they stand, I've tried html2canvas but it doesn't seem to work. I've tried placing the iframe inside a div but no joy.

I've seen various methods of achieving this using php, but nothing that seems clear. Can anyone shed any light?

I have the following iframe:

<iframe name="content" src="" style="position: absolute; left: 0px; top: 28px;" allowtransparency="true" border="0" scrolling="yes" width="100%" frameborder="0" height="90%" id="MyFrame"></iframe>

I simply want to capture a screenshot of the iframe contents as they stand, I've tried html2canvas but it doesn't seem to work. I've tried placing the iframe inside a div but no joy.

I've seen various methods of achieving this using php, but nothing that seems clear. Can anyone shed any light?

Share Improve this question asked Nov 24, 2014 at 15:38 AdamHAdamH 1412 gold badges5 silver badges16 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

It's written in the limitations section of the doc: http://html2canvas.hertzen./documentation.html#limitations.

The script doesn't render plugin content such as Flash or Java applets. It doesn't render iframe content either.

Screen capture using JS raises security problems.

Recently I've been trying carota (https://github./danielearwicker/carota) with some success to render HTML text on a canvas. However, it only handles a small subset of HTML.

There is also the SVG foreignobjectapproach which makes it possible to render DOM objects in a canvas: https://developer.mozilla/en-US/docs/Web/API/Canvas_API/Drawing_DOM_objects_into_a_canvas

Unfortunately, it is not implemented in IE, including IE 11.

发布评论

评论列表(0)

  1. 暂无评论