Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>is it at all possible to install the Dart VM on client machines for use in foreign browsers?</p> </blockquote> <p>It is, however it is easier to supply the Dart VM yourself.</p> <hr> <p>Javascript is perfectly able to:</p> <ul> <li>Find a <code>script</code> of a specific <code>type</code></li> <li>Convert the script into Javascript</li> <li>Execute the compiled script</li> </ul> <p>While this is technically not a Dart Virtual Machine, it will get your Dart code executed at full speed. However, you do have to wait for the compilation to complete. The usual way is to do the compilation on the server (once), and only send the compiled javascript to clients.</p> <p>Another option is interpreted code. Instead of compiling to javascript, the Dart instructions are executed one-by-one. Dart is not a machine-level language, so it needs parsing, but what follows is interpretation. The downside is reduced performance. This will get you as close to having a full-blown virtual machine (separate from the Javascript one) as possible.</p> <p>Normally, you don't care which one you get (maybe you'll even get a just-in-time compiler), but it does make a difference in terms of a Dart <em>virtual machine</em> being present (rather than just getting your code executed). </p> <hr> <p>The Dart compiler needs to be present on the page somehow (unless you precompile).</p> <p>The easiest way is to just write <code>&lt;script src="path/to/your/dart-compiler.js"&gt;&lt;/script&gt;</code> into the head. </p> <p>The Dartium browser does support Dart natively, but it is not designed for common use. <a href="http://en.wikipedia.org/wiki/Dart_%28programming_language%29#Usage" rel="nofollow">Wikipedia says:</a></p> <blockquote> <p>In the Dartium Browser: The Dart SDK ships with a version of the Chromium web browser modified to include a Dart virtual machine. This browser can run Dart code directly without compilation to Javascript. It is currently not intended for general-purpose use, but rather as a development tool for Dart applications.[7] <strong>When embedding Dart code into web apps, the current recommended procedure is to load a bootstrap JavaScript file, "dart.js", which will detect the presence or absence of the Dart VM and load the corresponding Dart or compiled Javascript code</strong>, respectively,[8] therefore guaranteeing browser compatibility with or without the custom Dart VM.</p> </blockquote> <p>If you want the ability to run Dart be dependent on the client machine rather than on the page, there are a few ways too.</p> <p>One way is to include the compiler as a user-script. This will work in <del>all</del> both modern desktop browsers. However, I'm not sure if there's an existing way to add user-script support to Internet Explorer.</p> <p>One way is to add a browser extension. All modern desktop browsers support extensions, and <a href="http://colonelpanic.net/2010/08/browser-plugins-vs-extensions-the-difference" rel="nofollow">Internet Explorer has Browser Helper Objects</a>.</p> <p>All of these will require the extra Javascript step. If you want native interpretation that bypasses Javascript, you need a plugin. Plugins require a specific mime-type to run (not sure if the script type counts), but you can install an extension that will trigger the use of the plugin. However, DOM manipulation <em>still</em> needs the extra Javascript step. There is no way around it. </p> <p>A desktop installer can definitely install a plugin into a browser. Indeed, this is the way plugins normally get installed. Installing extensions from a desktop installer might be possible as well, but I can't confirm or deny this last claim for now.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload