如何确保HTML表格递增呈现 [英] How to make sure an HTML table renders incrementally

查看:87
本文介绍了如何确保HTML表格递增呈现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个生成大型HTML表格的旧式CGI程序。由于表格内容计算速度慢(即使它不是那么大),我希望一次打印一行,并让浏览器在提取时显示行。

I have an old-style CGI program which generates a large HTML table. Because the table contents are slow to calculate (even though it's not that big) I would like to print it one row at a time, and have the browser display rows as they are fetched.

如果你在线搜索,你会看到style =table-layout:fixed应该可以帮助一些浏览器做到这一点,但另一方面,即使没有它,Firefox也可以递增渲染。我的测试浏览器是Windows 4.0的Firefox 4.0b10,但无法使用下面的简单示例逐步显示它:

If you search online you'll see that style="table-layout: fixed" is supposed to help some browsers do this, but on the other hand Firefox can render incrementally even without it. My test browser is Firefox 4.0b10 on Windows but I cannot get it to display incrementally using the simple example below:

<html>
  <head>
    <title>x</title>
  </head>
  <body>
    <table width="100%" style="table-layout: fixed" rows="4" cols="4">
      <col width="10%" />
      <col width="20%" />
      <col width="30%" />
      <col width="40%" />
      <tr><td width="10%">a</td><td width="20%">b</td><td width="30%">c</td><td width="40%">d</td></tr>
      <!-- flush output, one second pause... -->
      <tr><td width="10%">a</td><td width="20%">b</td><td width="30%">c</td><td width="40%">d</td></tr>
      <!-- flush output, one second pause... -->
      <tr><td width="10%">a</td><td width="20%">b</td><td width="30%">c</td><td width="40%">d</td></tr>
      <!-- flush output, one second pause... -->
      <tr><td width="10%">a</td><td width="20%">b</td><td width="30%">c</td><td width="40%">d</td></tr>
      <!-- flush output, one second pause... -->
    </table>
  </body>
</html>

直到下载结束,整个表格出现时,页面才会变为空白。我已经尝试过各种方式来提前告诉浏览器表格的尺寸,所以它在到达时显示它应该没有问题,但是它们没有帮助。 (删除提示也没有帮助。)

Instead the page is blank until the end of the download, when the whole table appears. I've tried various ways to tell the browser the table dimensions in advance so it should have no problem displaying it as it arrives, but they don't help. (Removing the hints doesn't help either.)

如果我修改我的CGI脚本以关闭并重新启动每行之间的表格,并在其间添加一个空白段落,那么页面在浏览器中增量呈现。这表明数据逐渐进入浏览器 - 只是Firefox选择不呈现它。

If I modify my CGI script to close and restart the table between each row, with an extra blank paragraph in between, then the page does render incrementally in the browser. This shows that the data is getting to the browser incrementally - just Firefox is choosing not to render it.

具有讽刺意味的是,产生更大表格的更复杂的脚本似乎做了我希望在下载时一次显示一行,但每当我尝试将输出减少到最小测试用例时,它都不起作用。这导致我怀疑Firefox的渲染引擎使用了一些复杂的启发式方法。

Ironically, much more complex scripts producing larger tables seem to do what I want, showing one row at a time as it downloads, but whenever I try to reduce the output to a minimal test case it doesn't work. This leads me to suspect there is some complexity heuristic used by Firefox's rendering engine.

到目前为止,我需要告诉浏览器总是将表格显示为已下载的数据?

What's the magic dust I need to tell the browser to always display the table as downloaded so far?

推荐答案

这是值得的。
使用Firefox 3.6.16的Firefox在下载页面之前不会显示,无论正在下载什么内容。

For what it is worth. The Firefox I use Firefox 3.6.16 does not display until the page is downloaded, regardless of what is being downloaded.

您可以查找关于:配置,但我还没有看到任何解决方案,
有帮助显示占位符的插件。但他们并不总是工作。

You could look for settings in about:config, but I have not seen any solution to this, there are addins to help with displaying placeholders. but they don't always work either.

刚刚发现这个

阅读或尝试

about:config   - in browse bar
select new
create integer
nglayout.initialpaint.delay
set value to 0

干杯

这篇关于如何确保HTML表格递增呈现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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