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

前端 未结 4 561
天涯浪人
天涯浪人 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 01:47

    It's impossible in pure JavaScript, without using ActiveX.

    0 讨论(0)
  • 2020-11-30 01:57

    Google is doing this in Google+ and a talented developer reverse engineered it and produced http://html2canvas.hertzen.com/ . To work in IE you'll need a canvas support library such as http://excanvas.sourceforge.net/

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2020-11-30 02:12

    I think using JavaScript, you won't be able to due to the security restrictions. Flash, possibly.

    0 讨论(0)
提交回复
热议问题