The async support as specified by google is achieved using two parts:
using script on your page (the script is supplied by google) to write out a <script> tag to the DOM.
that script has async="true" attribute to signal to compatible browsers that it can continue rendering the page.
The first part works on browsers without support for <script async..
tags, allowing them to load async with a "hack" (although a pretty solid one), and also allows rendering the page without waiting for ga.js to be retrieved.
The second part only affects compatible browsers that understand the async html attribute
- FF 3.6+
- FF for Android All Versions
- IE 10+ (starting with preview 2)
- Chrome 8+
- Chrome For Android All versions
- Safari 5.0+
- iOS Safari 5.0+
- Android Browser 3.0+ (honeycomb on up)
- Opera 15.0+
- Opera Mobile 16.0+
- Opera Mini None (as of 8.0)
The "html5 proper" way to specify async is with a <script async src="..."
, not <script async="true"
. However, initially browsers did not support this syntax, nor did they support setting the script property on referenced elements. If you want this, the list changes:
- FF 4+
- IE 10+ (preview 2 and up)
- Chrome 12+
- Chrome For Android 32+
- Safari 5.1+
- No android versions
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…