1. 28
  1.  

  2. 3

    The author suggests chunk streaming text in an iframe. I can confirm this will work, as I used this technique years ago to make something work in IE6.

    1. 2

      Blog post or other reference for how this might be done?

      1. 1

        I wish I had a tech blog, but alas. Even if I did, my days of browsers and JavaScript are behind me.

        It’s pretty straightforward, the server simply streams data slowly, and because the iframe contains a full document the browser renders it incrementally. Using inline style you can manipulate the display of the partial document to show whatever you want. Inlining might not even be necessary in modern browsers. We sent along inline <script> tags with snippets of JS to delete old data.

        There’s some additional trickiness with request timeouts that was a pain to handle. These days there’s no reason not to use SSE. You can stay lean, as the API is incredibly simple and usable in vanilla JS. No libraries or outrageous npm dependency trees required.

        1. 1

          There’s some additional trickiness with request timeouts that was a pain to handle. These days there’s no reason not to use SSE.

          I’ve written a few websites without any javascript. Even if it’s just as a graceful degrading of abilities, it’s nice to know what I can or can not make a browser do.

          For example, I’m a big fan of the CSS checkbox hack. I’ve used it to beautify forms (changing label text to make the checkbox selection obvious, etcetera), and to change documents on the fly based on user selection, as well as the normal expanding menu trick.

          I know people who browse without javascript as a matter of course. If they might end up being customers, does it really make sense to reach to SSE and a polling/degraded experience or to make the js free experience as pleasant as possible?

          1. 1

            Do people browsing without javascript want persistent connections and server push? Making full page refresh fast seems like a better approach.

            If I absolutely needed to update an element in place without javascript, I would instead try an iframe with periodic refresh. Either using the HTTP header Refresh or <meta http-equiv="refresh">. Polling is severely underrated.

      2. 2

        I had a former employer that had a CI tool that did this for test logs.

        1. 1

          Perfect use case. Streaming the logs into an iframe conveniently puts those logs in their own scrollable box for you. A resizable box if you like, with resize: both; in CSS. You could also link to the iframe src directly if you wanted to view the full logs separately (or share them). You could display or hide UI for viewing the logs with a query param.