# Flush HTML head

**URL:** <https://www.ruby-forum.com/t/flush-html-head/173487>\
**Category:** Ruby\
**Created:** [August 10, 2009, 1:23pm UTC](https://www.ruby-forum.com/t/flush-html-head/173487 "2009-08-10T13:23:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![artchrst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e36b37/32.png) [@artchrst](https://www.ruby-forum.com/u/artchrst)\
**Post date:** [August 10, 2009, 1:23pm UTC](https://www.ruby-forum.com/t/flush-html-head/173487/1 "2009-08-10T13:23:31Z")

</div>

Hi Guys,

What command I should use to flush html head to client in my  
layout.rhtml?

I’ve tried “$stdout.flush” but weird, the CSS total time seems to be  
longer after using the flush.

Thanks!  
Arthur

---

<div class="post-metadata">

**Author:** ![artchrst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e36b37/32.png) [@artchrst](https://www.ruby-forum.com/u/artchrst)\
**Post date:** [August 10, 2009, 1:56pm UTC](https://www.ruby-forum.com/t/flush-html-head/173487/2 "2009-08-10T13:56:37Z")

</div>

Arthur C. wrote:

> What command I should use to flush html head to client in my  
> layout.rhtml?
> 
> I’ve tried “$stdout.flush” but weird, the CSS total time seems to be  
> longer after using the flush.

If this is a problem with Ruby On Rails (the web application framework),  
it would be best asked on a Rails mailing list. This one is for Ruby  
(the programming language).

I’m pretty sure that in any web framework, you’ll find that stdout is  
not the socket connected to the client. In normal Rails request  
processing, the whole response body is built _before_ it starts being  
sent back to the client. If you want to do low-level stuff like sending  
progressive pages, look at the Rack API (which Rails now runs on top of,  
and exposes as “Rails Metal”).

---

<div class="post-metadata">

**Author:** ![artchrst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e36b37/32.png) [@artchrst](https://www.ruby-forum.com/u/artchrst)\
**Post date:** [August 10, 2009, 2:02pm UTC](https://www.ruby-forum.com/t/flush-html-head/173487/3 "2009-08-10T14:02:35Z")

</div>

Thanks Brian! I’ve reposted the question to Rails.

Brian C. wrote:

> Arthur C. wrote:
> 
> > What command I should use to flush html head to client in my  
> > layout.rhtml?
> > 
> > I’ve tried “$stdout.flush” but weird, the CSS total time seems to be  
> > longer after using the flush.
> 
> If this is a problem with Ruby On Rails (the web application framework),  
> it would be best asked on a Rails mailing list. This one is for Ruby  
> (the programming language).
> 
> I’m pretty sure that in any web framework, you’ll find that stdout is  
> not the socket connected to the client. In normal Rails request  
> processing, the whole response body is built _before_ it starts being  
> sent back to the client. If you want to do low-level stuff like sending  
> progressive pages, look at the Rack API (which Rails now runs on top of,  
> and exposes as “Rails Metal”).
