The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

infos@wais-fr.com (29) [Avatar] Offline
#1
I have setup a dev environment with Visual Studio 2010, IIS and ASP.NET MVC3 for the widget provider. I am using IE9 and google chrome 15.0. to test the Publisher.

I am testing the async method with the following code :
<!doctype html >
<html>
<head>
<title></title>
</head>
<body>

script is loading asynchronously ... (only in HTML5 compatible Web Browsers)


<script async src="http://widget.dev/ThirdPartyjavascript/js/BlockingWidget/1234"></script>
<h1>Welcome</h1>

page has finished rendering


</body>
</html>

the async scenario works only in Google Chrome and NOT in IE9.
if you slightly change the script element to :
<script async defer src="http://widget.dev/ThirdPartyjavascript/js/BlockingWidget/1234"></script>
then it works in BOTH IE9 and Chrome.

Best regards
Henri d'Orgeval
benvinegar (68) [Avatar] Offline
#2
Re: 2.2.2 Asynchronous script include
The "defer" attribute is slightly different than async. It downloads the script file asynchronously, but doesn't execute that script until the entire document has been parsed (whereas async scripts execute immediately after they're downloaded). It also preserves execution order against other scripts that declare the defer attribute.

But you're right - IE doesn't support async until IE10 (according to this: https://developer.mozilla.org/En/HTML/Element/Script). If we've made that mistake in the book, we'll correct it. We should also mention defer, at least in passing.