For performance reasons, it is very important to have script tags have one of the following two forms (preferably the first I think, but if this is added then the second should also be made accessible):
Alas CHtml::scriptFile() doesn't have any such option, and consecutively CClientScript can't do it. I think this would be a very helpful add on.
+1 please add these options
Allow registering scripts as async, [closes #1724]
Both "async" and "defer" should be available.
Do not forget about "onload" option for the "script" tag. It also may be useful.
Perhaps this feature can satisfy #198
For #198, I think require.js would be the correct solution. In fact implementing require.js into Yii would be the best solution, that's what I did for myself, and then having the ability to use CClientScript::registerScript() with a require parameter that wraps the whole script in a require() block. But I read somewhere on the forum that require.js was not wanted in Yii, so I didn't pursue this any further.
This is also why I consider this issue here kind of unimportant now, just registering async only very rarely is what you want, require.js is the correct solution. But Yii doesn't want it I guess.
Issue #1724 has been added to CHANGELOG
Position of issue #1724 mention at CHANGELOG has been fixed.
Voting for #2172 to be merged instead of #2093.
Another real use case: http://vk.com/pages.php?act=share
Embedding code requires charset attribute to be set:
<!-- Put this script tag to the <head> of your page -->