Redefine jQuery using document.writeln()
<p>I'm working on a Javascript library which is currently in use by our websites (> 8000).
Websites are calling a bootstrapper js that on it's turn will reference some other library scripts.</p>

<p>Since our JavaScript library heavily uses jQuery, it's currently included in the bootstrapper as well.</p>

<p>This is done using document.writeln:</p>

<pre><code>document.writeln("&lt;script src=\"js\/jquery-1.4.4.min.js\" type=\"text\/javascript\"&gt;&lt;\/script&gt;");
</code></pre>

<p>I'm aware that document.writeln isn't xHtml compliant and there are much better solutions, but this is just the way it currently works fine for all our websites and getting rid of document.writeln is not an option.</p>

<p>The problem now is that we get conflicts when a site already defines a lower version of jQuery. So, we decided redefine jQuery in our library:</p>

<pre><code>document.writeln("&lt;script src=\"js\/jquery-1.4.4.min.js\" type=\"text\/javascript\"&gt;&lt;\/script&gt;");
document.writeln("&lt;script type=\"text\/javascript\"&gt;");    
document.writeln("   var $myJQuery = jQuery.noConflict();");
document.writeln("&lt;/script&gt;");
</code></pre>

<p>Unfortunately, it doesn't work.</p>

<p>Does anybody have a solution? </p>
