如何截取网页的屏幕截图?

发布于 2024-07-15 21:54:47 字数 143 浏览 4 评论 0 原文

我想在我们的一个网站上添加一个按钮,允许用户使用我们的错误跟踪系统提交错误。

功能请求之一是发送相关页面的屏幕截图。

如果不在最终用户计算机上安装某些内容,我该如何执行此操作? javascript 有某种屏幕截图 API 吗?

I want to add a button to one of our web sites that will allow the user to file a bug with our bug tracking system.

One of the feature requests is that a screen cap of the page in question be sent along.

Without installing something on the end users machine, how can I do this? Does javascript have some sort of screen cap api?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(11

风筝在阴天搁浅。 2024-07-22 21:54:47

您可以获取页面的innerHTML,然后在服务器上处理它:

document.getElementsByTagName('html')[0].innerHTML;
// this would also be interactive (i.e. if you've
// modified the DOM, that would be included)

You may grab the innerHTML of the page and then process it on the server:

document.getElementsByTagName('html')[0].innerHTML;
// this would also be interactive (i.e. if you've
// modified the DOM, that would be included)
无声情话 2024-07-22 21:54:47

不,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.

浅忆流年 2024-07-22 21:54:47

使用 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.

瞎闹 2024-07-22 21:54:47

我建议与 FireShot< 进行某种集成/strong> 这是一个免费的 Firefox/IE 插件。

I'd suggest some sort of integration with FireShot which is a Free Firefox/IE addon.

丢了幸福的猪 2024-07-22 21:54:47

我同意其他答案——没有骰子。

不过,有一个 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.

琉璃繁缕 2024-07-22 21:54:47

看看 pagecrop (使用jQuery + jCrop插件实现)

Take a look at pagecrop (implemented with jQuery + jCrop plug-in)

心不设防 2024-07-22 21:54:47

我肯定漏掉了一些东西,但你不能...

按键盘上的 PrtScr 并粘贴到电子邮件中。

I must be missing something, but can't you just...

Press PrtScr on keyboard and paste into email.

此刻的回忆 2024-07-22 21:54:47

请参阅此问题。 基本上,不,不是用 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.

自演自醉 2024-07-22 21:54:47

您可以考虑使用基于网络的解决方案,例如 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.

坐在坟头思考人生 2024-07-22 21:54:47

您还可以看看 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文