var _gaq = _gaq || ; _gaq.push(['_setAccount', 'UA-37560502-1']); _gaq.push(['_trackPageview']);
Looks great, doesn’t?, just think on the possibilities!!, but wait, reading the post I found that is only supported on IE10+, to bad since I still work on projects where the standard involve using IE7/8, so will not be possible at least for me to start using this new feature in a current project, the dream was to short, well at least at that moment.
It is also very similar but instead of loading the file asynchronously, it guarantees that the files are executed in the order they occur in the page. It only runs the scripts after parsing is completely finished. But that is not what I was looking for.
Just take note that the browser support for the Async attribute looks like this (from Dean Hume post):
- FireFox 3.6+
- Internet Explorer 10+
- Chrome 8+
- Safari 5.0+
- Android Browser Honeycomb and Ice Cream Sandwich
- Possible support in Opera starting in 12+
Also you can check on the IE website the HTML5 Async scripts loading example, it gives a good understanding of what I’m talking about.
Non-blocking loading is the key to fast pages. Moreover Head JS loads scripts in parallel no matter how many of them and what the browser is. The speed difference can be dramatic especially on the initial page load when the scripts are not yet in cache. It’s your crucial first impression.”
Fantastic, isn’t!!??, and works on IE7/8+, horay, just what I was looking for!!.
But, how do we use it?
- First add Head JS file on head section:
With my example you can´t see the different on the performance of using or not Head JS, to see the difference by yourself check the next links:
There are more cool stuff you can do with Head JS like:
- Responsive Design / Media Queries
- CSS Router
- Browser Detection / Graceful Degradation
- Dynamic CSS
- CSS3 Feature Detection
- HTML5 Enabler
Here I show you one of them and in an easy way, feel free to visit the following links that I used to create this post:
I really hope you find this information useful.