Add ASYNC to <script> tag on when running document.head
<p>I'm trying to <em>inject</em> a JavaScript file into <code>&lt;head&gt;&lt;/head&gt;</code>. The JavaScript file is async, and I want to add it to the <code>script</code> tag when <em>injecting</em>.</p>

<p>This is what I have so far:</p>

<pre><code>var imported = document.createElement('script');
imported.src = 'http://domain/js/my.js';
imported.setAttribute("type", "text/javascript");
imported.async = async;
document.head.appendChild(imported);
</code></pre>

<p>This injects the JavaScript file, but I get error on line <code>imported.async = async;</code>:</p>

<blockquote>
  <p>uncaught ReferenceError: async is not defined</p>
</blockquote>

<p>And <code>async</code> is not added to the tag.</p>

<p>How can I add <code>async</code> into that <em>injected</em> JavaScript file?</p>

<p><em>PS: I'm not looking for a jQuery answer, only pure JavaScript.</em></p>