如何截取网页的屏幕截图?
我想在我们的一个网站上添加一个按钮,允许用户使用我们的错误跟踪系统提交错误。
功能请求之一是发送相关页面的屏幕截图。
如果不在最终用户计算机上安装某些内容,我该如何执行此操作? javascript 有某种屏幕截图 API 吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我想在我们的一个网站上添加一个按钮,允许用户使用我们的错误跟踪系统提交错误。
功能请求之一是发送相关页面的屏幕截图。
如果不在最终用户计算机上安装某些内容,我该如何执行此操作? javascript 有某种屏幕截图 API 吗?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(11)
您可以获取页面的
innerHTML
,然后在服务器上处理它:You may grab the
innerHTML
of the page and then process it on the server:不,javascript 没有这样的东西。
恐怕这会很难。 我想不出有什么可以在不安装在用户计算机上的情况下执行此操作。
我想被证明是错的,但至少这是给你的答案。
No, javascript does not have anything like this.
I'm afraid that this will be quite hard. I can not think anything that would do this without installing on users computer.
I'd like to be proven wrong, but atleast this is an answer for you.
使用 jQuery 获取尽可能多的有关用户环境的信息。 (jQuery.support)/用户代理/cookies/表单输入值、url(用于获取参数并了解哪个页面出现错误)
发送 Moff 提到的页面源。
尝试按现在的方式序列化 DOM,以便可以比较与原始页面的不同之处。
如果您需要保留页面的源代码以用于历史目的,那么发送页面的源代码也很有用,因为当您更新页面时,它会变得不同。
Get as much Info as you can about the user environment using jQuery. (jQuery.support) / user agent / cookies / form input values, the url (for get parameters and to know which page had an error)
Send the source of the page like mentionned by Moff.
Try serializing the DOM as it is now so you can compare what is different from the original page.
It is also useful to send the source of the page if you need to keep it for historic purposes, since when you update the page, it will be become different.
我建议与 FireShot< 进行某种集成/strong> 这是一个免费的 Firefox/IE 插件。
I'd suggest some sort of integration with FireShot which is a Free Firefox/IE addon.
我同意其他答案——没有骰子。
不过,有一个 Firefox 插件 Pearl Crescent Page Saver,可能值得研究一下相关任务。
I agree with the other answers -- no dice.
However, there is a firefox plugin, the Pearl Crescent Page Saver, which might be worth looking into for related tasks.
看看 pagecrop (使用jQuery + jCrop插件实现)
Take a look at pagecrop (implemented with jQuery + jCrop plug-in)
我肯定漏掉了一些东西,但你不能...
按键盘上的 PrtScr 并粘贴到电子邮件中。
I must be missing something, but can't you just...
Press PrtScr on keyboard and paste into email.
请参阅此问题。 基本上,不,不是用 javascript。 也许使用 ActiveX,但这又回到了在客户端 PC 上安装东西的问题。
考虑编写一个服务器端脚本来准确重复用户的请求(假设它不是在 POST 之后)并存储生成的 html 文件。
See this question. Basically, no, not with javascript. Perhaps with ActiveX, but that's back to installing things on the client's PC.
Consider writing a server-side script that repeats the user's request exactly (assuming it's not after a POST) and storing the resulting html file.
您可以考虑使用基于网络的解决方案,例如 Super Screenshot! 或 WebShotsPro.com。 根据您的需求,例如页面特定区域的屏幕截图,或从外界无法访问的页面,它可能不适合您,但它是一个想法。
You might look into using a web based solution such as the one offered at Super Screenshot! or WebShotsPro.com. Depending on your needs, such as screenshots of specific areas of pages, or pages inaccessible from the outside world, it may not work for you, but it is an idea.
Chrome插件
https://chrome.google.com/extensions/detail/ckibcdccnfeookdmbahgiakhnjcddpki
Chrome plugin
https://chrome.google.com/extensions/detail/ckibcdccnfeookdmbahgiakhnjcddpki
您还可以看看 Evernote 如何进行屏幕捕获,也许您可以与之结合或创建自己的 Chrome 扩展。 https://chrome.google.com/webstore/detail /evernote-web-clipper/pioclpoplcdbaefihamjohnefbikjilc?hl=en
You can also take a look at how Evernote does its screen capturing and maybe you can tie in to that or create your own chrome extension. https://chrome.google.com/webstore/detail/evernote-web-clipper/pioclpoplcdbaefihamjohnefbikjilc?hl=en