ariya.io About Talks Articles

Dart bootstrap: Dartium vs other browsers

1 min read

Lately there has been a change on how Dart can be started in the browser. Since no other browser except Dartium, a special build of Chromium, has built-in Dart support, the process has two possible strategies. This is evidenced if you start a simple project from Dart Editor and peek at the HTML file, especially the last script tag which points to dart.js in Dart project repository:

<script type="application/dart" src="hello.dart"></script>
<script src="http://dart.googlecode.com/svn/branches/bleeding_edge/dart/client/dart.js">
</script>

What does this dart.js file do? The logic is basically as follows.

This also means that if you just care about non-Dartium browsers, the payload could be simplified by including the generated JavaScript directly and skipping the bootstrapper completely. For the simple project referred before, the content could be just like:

<script src="hello.dart.js"></script>

Last but not least, this mailing-list post (dated Feb 5) states that this is still temporary, i.e. things may change again in the near future.

Related posts:

♡ this article? Explore more articles and follow me Twitter.

Share this on Twitter Facebook