As I talked about in the post, I have some pages that are popular with search engine visitors. They generally come to the page, read, and then leave. I serve CSS and Javascript in <style> and <script> tags on those pages so it's fewer HTTP requests, and loads faster.
Unless someone has a reason I should do otherwise?
"The key factor, then, is the frequency with which external JavaScript and CSS components are cached relative to the number of HTML documents requested. This factor, although difficult to quantify, can be gauged using various metrics. If users on your site have multiple page views per session and many of your pages re-use the same scripts and stylesheets, there is a greater potential benefit from cached external files."
I think I was confused with mixing content with code. Putting style information in tags seems to be bad but not in the header. Even Google seems to use inline script/style code in the head of their website.
I'm not sure about that inline issue - I hadn't heard that. I actually got that advice from Yahoo, I think. The inline Javascript and CSS makes the page load faster, so in theory it would help.
That is true if you have a one page site. Bundling all the JavaScript and HTML in with the CSS means downloading one HTTP resource instead of three. This is good for sites like the "Yahoo Homepage" - basically just one big page, Netvibes, Facebook.
But if you have multiple pages sharing the same styles, yes for once off load times, having the CSS and JavaScript inpage is better, but for a visit of more than one page, having the CSS and JavaScript as separate cacheable resources is far better, since the differences are now the page size of the pure HTML plus images, saving at least the packet sizes needed to transfer the same CSS and JavaScript on each page.
So the major multi-page properties of Yahoo use primarily one external CSS and one external JavaScript file on each property.
Thanks for that explanation. Based on what you said, I think I'm approaching it okay. On a few posts that have really high bounce rates, I use the Custom Post Template to serve CSS and JS inline on those pages (amongst other customizations). The rest of the site, I load them from external files.
Doesn't adding CSS and JavaScript inline hurt your google rank?