Screencapture from the browser using Javascript?

2020-04-11 06:54发布

I guess this is an odd one, and the answer is most likely it is not possible since it would represent a security breach; but I am looking for a way - if any - to get a screendump of content inside the browser. I don't need the entire window, but actually just need to dump the rendered state of an tag. It need to be cross platform and cross browser compatible.

标签: javascript
2条回答
霸刀☆藐视天下
2楼-- · 2020-04-11 07:14

If you don't need an actual screen shot, you can grab the innerHTML of your content and send it back to the server via Ajax, stash it somewhere and view it remotely.

查看更多
够拽才男人
3楼-- · 2020-04-11 07:21

It cannot be done (yet) in pure JavaScript.

As a side-note, if your goal is to make rendering tests, you could try instantiating the target browsers within a hosted environment (i.e. host Internet Explorer in a WinForms application and get a screenshot of the rendered content) - this will show the Silverlight plug-in and allow taking screenshots.

查看更多
登录 后发表回答