Dynamically insert script and execute immediately
<p>I'm building a webservice that automatically combines and minifies a website's javascript. The web owner would just include the following js snippet in the website head, and it creates the minified file and appends it to the head element.</p>

<p>The issue I'm seeing is that when a script is dynamically appended it is not necessarily executed before the rest of the body. Since many sites may expect the head scripts to execute before the body is generated, this is an issue. </p>

<p>Is there any way I can force the dynamically appended script to execute before anything else? Maybe there is a workaround, like removing the entire body and reinserting it after the appending script loads.. although that seems pretty hacky.</p>

<pre><code>&lt;script type="text/javascript"&gt;
    var minify_files = new Array(
        'domain.com/js/one.js',
        'domain.com/js/two.js',
        'domain.com/js/three.js'
    );
&lt;/script&gt;
&lt;script type="text/javascript" src="minifyservice.com/minify.js"&gt;&lt;/script&gt;
</code></pre>
