Which browsers support <script async="async" />?
On December 1, 2009, Google announced support for asynchronous Google Analytics tracking.
The asynchronous tracking is achieved using the async directive for the <script>
tag.
Which browsers support the async directive ( <script async="async" />
) and since which version?
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
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:
There's two parts to this question, really.
Q: Which browsers support the "async" attribute on a script tag in markup?
A: IE10p2+, Chrome 11+, Safari 5+, Firefox 3.6+
Q: Which browsers support the new spec that defines behavior for the "async" property in JavaScript, on a dynamically created script element?
A: IE10p2+, Chrome 12+, Safari 5.1+, Firefox 4+
As for Opera, they are very close to releasing a version which will support both types of async. I've been working with them closely on this, and it should come out soon (I hope!).
More info on ordered-async (aka, "async=false") can be found here: http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order
Also, to test if a browser supports the new dynamic async property behavior: http://test.getify.com/test-async/
这里提供了支持async
参数的浏览器版本的完整列表
上一篇: CSS垂直对齐图像中间的文本