Friday, August 20, 2010

Terrence Ryan taught me why <cfhtmlfoot> is not needed

I guess most of you have heard of or used <cfhtmlhead> for injecting things in between <head></head> in html, right?

Today I came across a blog post which talks about frontend performance tips, and one of them is to include script tags in the bottom of the page to avoid blocking (for more tips, see http://code.google.com/speed/articles/ ).  I know this tip for a while now, but I found myself hard to implement it with most MVC frameworks I used (i.e. MG2, ColdBox, FW/1).  For a second I really wish there's a <cfhtmlfoot> tag.  So I asked on the tweeter, and @tpryan replied:

@henrylearn2rock I use the request scope for this. Inject code into request.footer, then in the closing of my view, check for and publish.
Nice!  I guess we don't need <cfhtmlfoot> after all.  Thanks Terrence.

edit: gosh blogger, html encode post title and body ALREADY! And why are URL's not turned into hyperlinks automatically? You suck! It's 2010!!!

update: wow! look at this reply from @mach_ii!

@henrylearn2rock M2 supports this on OpenBD. cfhtmlbody: http://is.gd/esh24 & htmlbody(): http://is.gd/esh0Z Railo tix: http://is.gd/esh7x

update: oh, my man tpryan also blogged about this: Injecting JavaScript to the foot of a ColdFusion Page