title: JavaScript, namespace, IE11 error SCRIPT5009
body: <p>This is the HTML page:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;script type="text/javascript" src="test.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;script type="text/javascript"&gt;
      var myobject = new mynamespace.main.Main ("This is string.");
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Ant this is <strong>test.js</strong>:</p>
  
  <pre><code>var mynamespace =
  {
      main:
      {
          controller: {},
          view: {}
      },
  
      elements: {}
  };
  
  mynamespace.main.Main = function (string)
  {
      this.string = string;
      this.controller = new mynamespace.main.controller.Controller (this.string);
  }
  
  mynamespace.main.controller.Controller = function (string)
  {
      this.view = new mynamespace.main.view.View (string);
      this.element = new mynamespace.elements.Element (string);
      console.log ("Controller, string: " + string);
  }
  
  mynamespace.main.view.View = function (string)
  {
      console.log ("View, string: " + string);
  }
  
  mynamespace.elements.Element = function (string)
  {
      console.log ("Element, string: " + string);
  }
  </code></pre>
  
  <p>Both files are placed in the same folder.</p>
  
  <p>Internet Explorer 11 return error: <strong>SCRIPT5009: Object mynamespace is not defined.</strong></p>
  
  <p>This code work only if I placed the code of <strong>test.js</strong> into HTML page. How can I fixed it please?</p>
  
  <p>I don't use any library like jQuery.</p>