Head JS

  • Started
  • Last post
  • 4 Responses
  • Hue

    Has anyone had any luck with Head JS? Anyone try it out? http://headjs.com/

    Having Problems getting Cufon to work across all browsers with it, wondered if anyone had any tips or possible alternatives. Liking the use of browser specific css, and browser size specific css

  • jadrian_uk0

    use jQuery and cufon.
    it says "Target CSS for different screens, paths, states and browsers",
    taht's completely useless, one css sheet for all is the way.
    I really hate all these script guys building abstractions that are rather useless just to gain some recognition.

  • fugged0

    Agreed - And it's purely a perception thing. You page may seem to load faster, but it's still making the same number of http requests (actually it's making one more).

    Also - if your page depends on JS to function and you are using DOM ready functions, your page isn't going to be "ready" any faster with headjs. You may actually notice weirdness if you do a bunch of display oriented things on DOM ready. As element that may need to be modified will be displayed sooner than previously anticipated.

  • chow0

    I don't know if I like head.js, I already use other libraries that provide the same functionality. However, I still disagree with some of the points raised above.

    1. Perception is everything. Users do not care how many HTTP requests are required to load a page, they care that the page was usable quickly. This can be improved using non-blocking and parallel JS loading, which head.js claims to provide.

    2. If your page relies on DOM ready, you can get there faster by loading your JS in parallel. Of course a better way to improve things is to not rely solely on DOM ready.

    3. CSS browser targeting via JS is very useful, and does not imply that more than one style sheet is required, in fact being able to put styles for different target devices in the same sheet is the main benefit. Like say adding some iPad-specific declarations without having to load a separate sheet for iPad. If you think this is useless, perhaps it's because you have never developed something requiring this level of sophistication :)

    @Hue, if all you need is browser-specific CSS, check out https://github.com/rafaelp/css_b…

  • fugged0

    ^

    1. Agreed, however the point I was trying to make is that headjs isn't going to magically load everything faster. You're still making the same number of requests. You're still limited to the number of concurrent connections, etc...

    2. Not necessarily. As I said, if functionality in the page requires the dom to be ready, and requires the javascript to be loaded, it's not going to matter.

    Simply moving your javascript to the bottom of the page will achieve a similar behavior.

    • Good points. I tend to use the "JS at the bottom" approach too.chow
    • Regarding #2, there are gains to be had by optimizing your JS to not rely on DOM ready...chow
    • ...I have not used DOM ready in a JS app for years :)chow