JavaScript code to take a screenshot of a website without using ActiveX

前端 未结 4 562
天涯浪人
天涯浪人 2020-11-30 01:34

I have a JavaScript application that an user interacts with. I need to save the appearance of the interface at the current time, crop out the part that I need (or only shot

4条回答
  •  遥遥无期
    2020-11-30 02:00

    It is impossible using JavaScript (nor Flash). It depends on your constraints, and there are some workarounds.

    1. You can take advantage of browser extensions (such as a Firefox add-on), but I guess it does not fit your requierments.
    2. The best option I can think of is to construct the DOM tree on the client side, and then post it to remote server.

    On the server side nothing really holds you from doing generally anything. Using WebKit or even launching Internet Explorer or Firefox, you can create the snapshot server-side. It's far from elegant, but possible.

提交回复
热议问题