title: How can code in a JavaScript file get the file's URL?
body: <p>I need to dynamically load a CSS stylesheet into a page that's on a <em>different</em> domain. How can I get the complete URL of the JS file to use in the <strong>href</strong> attribute of the stylesheet? </p>
  
  <p>For instance, here is the structure:</p>
  
  <p><code>http://bla.com/js/script.js</code></p>
  
  <p><code>http://bla.com/css/style.css</code> </p>
  
  <p>I want to dynamically load the stylesheet into a page <strong><a href="http://boo.net/index.html" rel="noreferrer">http://boo.net/index.html</a></strong>. The problem is, I don't know the <strong>bla.com</strong> bit in advance, just the fact that the stylesheet is in <strong>../css/</strong> relative to the JS file.</p>
  
  <p>The script is, of course, included on <strong>index.html</strong>. jQuery's fine too.</p>