On December 1, 2009, Google announced support for asynchronous Google Analytics tracking.
2009年12月1日,谷歌宣布支持异步谷歌分析跟踪。
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?
哪些浏览器支持异步指令(),从哪个版本开始?
6 个解决方案
#1
157
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.
使用页面上的脚本(该脚本由谷歌提供)向DOM编写一个
-
that script has async="true" attribute to signal to compatible browsers that it can continue rendering the page.
该脚本具有async="true"属性,可以向兼容的浏览器发出信号,以便继续呈现页面。
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
第二部分只影响理解异步html属性的兼容浏览器
- FF 3.6+
- FF 3.6 +
- FF for Android All Versions
- FF适用于Android所有版本
- IE 10+ (starting with preview 2)
- IE 10+(从预览2开始)
- Chrome 8+
- Chrome 8 +
- Chrome For Android All versions
- Android所有版本的Chrome。
- Safari 5.0+
- Safari 5.0 +
- iOS Safari 5.0+
- iOS Safari 5.0 +
- Android Browser 3.0+ (honeycomb on up)
- Android浏览器3.0+(蜂巢在上)
- Opera 15.0+
- Opera 15.0 +
- Opera Mobile 16.0+
- Opera Mobile 16.0 +
- Opera Mini None (as of 8.0)
- Opera Mini None(从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:
指定异步的“html5专有”方式是使用
- FF 4+
- FF 4 +
- IE 10+ (preview 2 and up)
- IE 10+(预览2及以上)
- Chrome 12+
- Chrome 12 +
- Chrome For Android 32+
- 铬为Android 32 +
- Safari 5.1+
- Safari 5.1 +
- No android versions
- 没有安卓版本
#2
60
There's two parts to this question, really.
这个问题有两部分。
-
Q: Which browsers support the "async" attribute on a script tag in markup?
问:哪些浏览器支持标记中的脚本标记上的“async”属性?
A: IE10p2+, Chrome 11+, Safari 5+, Firefox 3.6+
答:IE10p2+, Chrome 11+, Safari 5+,火狐3.6+
-
Q: Which browsers support the new spec that defines behavior for the "async" property in JavaScript, on a dynamically created script element?
问:哪些浏览器支持在动态创建的脚本元素上定义JavaScript“async”属性行为的新规范?
A: IE10p2+, Chrome 12+, Safari 5.1+, Firefox 4+
答:IE10p2+, Chrome 12+, Safari 5.1+,火狐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!).
至于Opera,他们非常接近于发布一个支持两种异步方式的版本。我一直在和他们密切合作这件事,它应该会很快出来(我希望!)
More info on ordered-async (aka, "async=false") can be found here: http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order
更多关于订购-异步的信息(即“async=false”)可以在这里找到: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/
还要测试浏览器是否支持新的动态异步属性行为:http://test.getify.com/testing -async/
#3
25
A comprehensive list of browser versions supporting the async
parameter is available here
这里提供了支持异步参数的浏览器版本的全面列表
#4
9
From your referenced page:
从你的引用页:
http://googlecode.blogspot.com/2009/12/google-analytics-launches-asynchronous.html
http://googlecode.blogspot.com/2009/12/google-analytics-launches-asynchronous.html
Firefox 3.6 is the first browser to officially offer support for this new feature. If you're curious, here are more details on the official HTML5 async specification.
Firefox 3.6是第一个正式支持这个新功能的浏览器。如果您好奇,这里有关于官方HTML5异步规范的更多细节。
#5
1
The async
is currently supported by all latest versions of the major browsers. It has been supported for some years now on most browsers.
目前主要浏览器的所有最新版本都支持异步。在大多数浏览器上支持它已经有好几年了。
You can keep track of which browsers support async (and defer) in the MDN website here:
https://developer.mozilla.org/en-US/docs/HTML/Element/script
在这里,您可以跟踪哪些浏览器支持异步(和延迟):https://developer.mozilla.org/en-US/docs/HTML/Element/script
#6
0
Just had a look at the DOM (document.scripts[1].attributes) of this page that uses google analytics. I can tell you that google is using async="".
只要看一下这个使用谷歌分析的页面的DOM (document.scripts[1].attributes)。我可以告诉你谷歌正在使用async="" "
[type="text/javascript", async="", src="http://www.google-analytics.com/ga.js"]
#1
157
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.
使用页面上的脚本(该脚本由谷歌提供)向DOM编写一个
-
that script has async="true" attribute to signal to compatible browsers that it can continue rendering the page.
该脚本具有async="true"属性,可以向兼容的浏览器发出信号,以便继续呈现页面。
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
第二部分只影响理解异步html属性的兼容浏览器
- FF 3.6+
- FF 3.6 +
- FF for Android All Versions
- FF适用于Android所有版本
- IE 10+ (starting with preview 2)
- IE 10+(从预览2开始)
- Chrome 8+
- Chrome 8 +
- Chrome For Android All versions
- Android所有版本的Chrome。
- Safari 5.0+
- Safari 5.0 +
- iOS Safari 5.0+
- iOS Safari 5.0 +
- Android Browser 3.0+ (honeycomb on up)
- Android浏览器3.0+(蜂巢在上)
- Opera 15.0+
- Opera 15.0 +
- Opera Mobile 16.0+
- Opera Mobile 16.0 +
- Opera Mini None (as of 8.0)
- Opera Mini None(从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:
指定异步的“html5专有”方式是使用
- FF 4+
- FF 4 +
- IE 10+ (preview 2 and up)
- IE 10+(预览2及以上)
- Chrome 12+
- Chrome 12 +
- Chrome For Android 32+
- 铬为Android 32 +
- Safari 5.1+
- Safari 5.1 +
- No android versions
- 没有安卓版本
#2
60
There's two parts to this question, really.
这个问题有两部分。
-
Q: Which browsers support the "async" attribute on a script tag in markup?
问:哪些浏览器支持标记中的脚本标记上的“async”属性?
A: IE10p2+, Chrome 11+, Safari 5+, Firefox 3.6+
答:IE10p2+, Chrome 11+, Safari 5+,火狐3.6+
-
Q: Which browsers support the new spec that defines behavior for the "async" property in JavaScript, on a dynamically created script element?
问:哪些浏览器支持在动态创建的脚本元素上定义JavaScript“async”属性行为的新规范?
A: IE10p2+, Chrome 12+, Safari 5.1+, Firefox 4+
答:IE10p2+, Chrome 12+, Safari 5.1+,火狐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!).
至于Opera,他们非常接近于发布一个支持两种异步方式的版本。我一直在和他们密切合作这件事,它应该会很快出来(我希望!)
More info on ordered-async (aka, "async=false") can be found here: http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order
更多关于订购-异步的信息(即“async=false”)可以在这里找到: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/
还要测试浏览器是否支持新的动态异步属性行为:http://test.getify.com/testing -async/
#3
25
A comprehensive list of browser versions supporting the async
parameter is available here
这里提供了支持异步参数的浏览器版本的全面列表
#4
9
From your referenced page:
从你的引用页:
http://googlecode.blogspot.com/2009/12/google-analytics-launches-asynchronous.html
http://googlecode.blogspot.com/2009/12/google-analytics-launches-asynchronous.html
Firefox 3.6 is the first browser to officially offer support for this new feature. If you're curious, here are more details on the official HTML5 async specification.
Firefox 3.6是第一个正式支持这个新功能的浏览器。如果您好奇,这里有关于官方HTML5异步规范的更多细节。
#5
1
The async
is currently supported by all latest versions of the major browsers. It has been supported for some years now on most browsers.
目前主要浏览器的所有最新版本都支持异步。在大多数浏览器上支持它已经有好几年了。
You can keep track of which browsers support async (and defer) in the MDN website here:
https://developer.mozilla.org/en-US/docs/HTML/Element/script
在这里,您可以跟踪哪些浏览器支持异步(和延迟):https://developer.mozilla.org/en-US/docs/HTML/Element/script
#6
0
Just had a look at the DOM (document.scripts[1].attributes) of this page that uses google analytics. I can tell you that google is using async="".
只要看一下这个使用谷歌分析的页面的DOM (document.scripts[1].attributes)。我可以告诉你谷歌正在使用async="" "
[type="text/javascript", async="", src="http://www.google-analytics.com/ga.js"]