title: XMLHttpRequest javascript prototypes not working
body: <p>We're trying to include our website by w3-include-html function on another website, followed by some xmlhttprequests for the *.js files. </p>
  
  <pre><code>function loadJS(url,onDone,onError){
  var xhr=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP");
  xhr.onreadystatechange=function(){
      if(xhr.readyState==4){
          if(xhr.status==200||xhr.status==0){
              setTimeout(function(){
                  try{
                      eval(xhr.responseText);
                  }catch(e){
                  }
                  onDone();
              }.bind(this),1);
          }else{
          }
      }
  }.bind(this);
  try{
      xhr.open("GET",url,true);
      xhr.send();
  }catch(e){
  }};
  </code></pre>
  
  <p>This seems to work, only calling on function from another .js-file stops the execution. Manually calling the function from browser-console throws <br>
  <strong>Uncaught ReferenceError: splash is not defined
      at :1:1</strong> <br>
  This only happens for functions that are also prototypes.</p>
  
  <p>First .js file: <br></p>
  
  <pre><code>var eless = function () {
  this.$body = $('body');
  var self = this;
  window.dataLayer = window.dataLayer || [];
  
  this.init();
  this.loop();
  console.log("before");
  new splash();
  console.log("after");
  </code></pre>
  
  <p>second .js file:</p>
  
  <pre><code>var splash = function() {
  console.log('after after');
  console.log(this.init);
  this.init();
  console.log("after after after");
  };
  splash.prototype = {
  init: function () {
      var self = this;
  [...]
  </code></pre>