title: Can document.write get me into troubles in this case?
body: <p>I have a simple question. Basically I have index.html:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  
     &lt;head&gt;
        &lt;title&gt;Title of document&lt;/title&gt;
     &lt;/head&gt;
  
     &lt;body&gt;
        &lt;script src="x.js"&gt;&lt;/script&gt;
  
        &lt;script&gt;
           iny();
        &lt;/script&gt;
     &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <hr>
  
  <pre><code>// x.js
  console.log("x.js");
  document.write("&lt;script src='y.js'&gt;&lt;/script&gt;");
  
  // y.js
  console.log("y.js");    
  function iny() {
     console.log("iny");
  }
  </code></pre>
  
  <p>As you can see, <code>x.js</code> loads <code>a.js</code> which, in turn, loads <code>y.js</code>. Here are the 2 scripts which live in 2 different files:</p>
  
  <p>As you can see <code>a.js</code> <strong>syncronously</strong> loads <code>y.js</code> using <code>document.write</code>.</p>
  
  <p>Now my question is: can document write get me into trouble in this case? My aim is to load <code>y.js</code> syncronously and that is the only reason why I am using the write. As far as I know there is no other way. Also it is not an option to have the code of <code>y.js</code> copy/pasted in to <code>x.js</code>. The 2 scripts <strong>must</strong> remain separate.</p>
  
  <p>Thanks</p>