Which browsers support <script async="async" />?

JavascriptHtmlPerformanceAsynchronousGoogle Analytics

Javascript Problem Overview


On December 1, 2009, Google announced support for http://googlecode.blogspot.com/2009/12/google-analytics-launches-asynchronous.html">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?

Javascript Solutions


Solution 1 - Javascript

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

Solution 2 - Javascript

There's two parts to this question, really.

  1. Q: Which browsers support the "async" attribute on a script tag in markup?

A: IE10p2+, Chrome 11+, Safari 5+, Firefox 3.6+

  1. 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/

Solution 3 - Javascript

A comprehensive list of browser versions supporting the async parameter is available here

Solution 4 - Javascript

From your referenced page:

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.

Solution 5 - Javascript

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

Solution 6 - Javascript

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="".

[type="text/javascript", async="", src="http://www.google-analytics.com/ga.js"]

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionknorvView Question on Stackoverflow
Solution 1 - JavascriptPhilip RieckView Answer on Stackoverflow
Solution 2 - JavascriptKyle SimpsonView Answer on Stackoverflow
Solution 3 - JavascriptJeremiahLeeView Answer on Stackoverflow
Solution 4 - JavascripttvanfossonView Answer on Stackoverflow
Solution 5 - JavascriptbrunoaisView Answer on Stackoverflow
Solution 6 - JavascriptjeekajooView Answer on Stackoverflow