如何使用js或jquery捕获html截图 [英] how to capture screenshot in html using js or jquery

查看:432
本文介绍了如何使用js或jquery捕获html截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要我的客户能够抓取我网站任何页面的截图。 =jsdata-hide =false>

< button>截图< / button>

我尝试使用html2canvas,但它是对我来说工作不正常,因为我的网站上有iframe,这会导致一些会话问题。



有人有解决方案吗?



我查看了Google的所有内容,但没有发现对我有帮助的东西。

解决方案

因为它们的性质,不是最好的被截图的东西;他们可以包括异步元素,框架或类似的东西,他们通常是响应等...



为了您的目的,最好的方法是使用外部api或外部服务,我认为尝试用JS做这件事并不是一个好主意。



您应该尝试 url2png


I'm need my clients be able to capture screenshot of any page of my website using button like this:

<button>Take screenshot</button>

I tried to use html2canvas but it's doesn't work properly for me because i have iframe's in my website and it's cause some session problems.

someone have solution for this?

i looked all over google and didn't found something that's helps me much.

解决方案

Web pages are not the best things to be "screenshoted", because of their nature; they can include async elements, frames or something like that, they are usually responsive etc...

For your purpose the best way is to use external api or an external service, I think is not a good idea to try doing that with JS.

You should try url2png

这篇关于如何使用js或jquery捕获html截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆