This App Won’t Run

As written, this application will not actually work anywhere…well, almost anywhere.

Dart is not supported in any browser (not even Chrome). To run this web application natively, we would need to install Dartium—a branch of Chrome that embeds the Dart VM. Dartium is available from the Dart Lang site.[3]

Even after Dart makes it into Chrome proper, we would still be faced with supporting only a subset of browsers on the market. That is just silly.

Fortunately, Dart can be compiled down to JavaScript, meaning that you can have the power of Dart but still target all platforms. To accomplish that easily, we add a small JavaScript library that, upon detecting a browser that does not support Dart, will load the compiled JavaScript equivalent.

your_first_dart_app/web/index_with_js_fallback.html
 
<!-- Enable fallback to Javascript -->
 
<script​ src=​"/scripts/conditional-dart.js"​​>​​</script>

We will discuss that helper file in detail in Chapter 5, Dart and JavaScript. For now, it is enough to note that our Dart code is not locked into a single browser vendor’s world. We are very definitely not seeing The Return of VBScript here.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.191.134