修改 Google Chrome 或 Mozilla Firefox 显示设置
我想知道是否可以修改 Chrome 或 Firefox 显示设置,使其仅显示 HTML DOM 对象的矩形?我想做的是尽可能减少渲染引擎的工作量,因此它只会构建页面的布局。
I would like to know if it is possible to modify Chrome or Firefox display settings, so that it would only show rectangles of HTML DOM objects? What I want to do is to decrease rendering engine job amount as much as possible, so it would only build layout of the page.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
人们通常将这种操作模式称为“无头”(即没有 UI)。
通常还有一个额外的要求 - 能够在服务器端运行它,而无需安装通常的客户端软件。如果您在客户端运行它,我不会担心优化,无论如何它都不会给您带来巨大的胜利。
否则,请尝试使用该术语进行搜索。我已经多次看到它提出要求,但还没有看到可用的现成解决方案。
[编辑]刚刚看到http://hg.mozilla.org/incubator/offscreen,其中似乎是 Mozilla 的无头版本。
People usually refer to this mode of operation as "headless" (i.e. without UI).
Usually there's an additional requirement - to be able to run it server-side without the usual for client software installed. If you're running it client-side, I wouldn't bother about optimization, it shouldn't give you a big win anyway.
Otherwise, try searching using that term. I've seen it asked for several times, but haven't seen a working out-of-box solution.
[edit] just saw http://hg.mozilla.org/incubator/offscreen, which seems to be a headless version of Mozilla.
我不会像修改渲染器那样低级。相反,我建议您使用 Firefox 的 Greasemonkey 来替换页面包含您需要的任何内容。您需要了解一些 JavaScript,但这并不难。
但是,这仅适用于客户端。如果您想在服务器端执行此操作(以便它可以在用户通过您自己请求的任何页面上工作),我的猜测是您需要以字符串形式获取页面的内容,然后使用 HTML 对其进行修改解析器。
I wouldn't go as low-level as modifying the renderer. Instead, I suggest you use Firefox's Greasemonkey to replace the elements from the page with whatever it is you need. You'll need to know a bit of JavaScript, but it's not that hard.
However, this will only work on client side. If you want to do this on server-side ( so that it will work on any page a user requests through your own ), my guess is you'll need to grab the page's content in a string, and then modify it using a HTML parser.