3 ms·
Yes, we talked about this yesterday. http://news.ycombinator.com/item?id=2780233 http://news.ycombinator.com/item?id=2780233 And this does the same thing with
by ck2 15y ago
Yes, we talked about this yesterday.
http://news.ycombinator.com/item?id=2780233 http://news.ycombinator.com/item?id=2780233
And this does the same thing without using proprietary code:
<script defer async src="blah"></script>
(and head.js won't do anything special in browsers where the above line isn't supported anyway)
- wulczer 15y agoIt's MIT licensed, so not proprietary. Did you mean to say "third-party"?
- padolsey 15y agoAFAIK, `defer` only works in IE, and `async` only works in: IE10p2+, Chrome 11+, Safari 5+, Firefox 3.6+ So some browsers would be left out, right?
- JoshTriplett 15y agoThat list represents most of the browsers people care about, with the exception of old IE. And "better with a modern browser, manages to function on old IE" seems like the right standard to shoot for most of the time, depending on your site's audience.
- pornel 15y agoThe pattern Async Analytics uses works in all browsers and it's simple enough that you don't need a library for it: var script = document.createElement('script'); script.async = true; // enables out of order execution script.src = '…' var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(script, s); http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html http://code.google.com/apis/analytics/docs/tracking/asyncTra...