title: Issue injecting external script with executeScript method in Cordova
body: <p>I'm writing a dummy app to test how works the executeScript() method inside Cordova's InAppBrowser plugin. In particular, I'm trying to inject a javascript code inside one webview.</p>
  
  <p>Here there is my index.html file:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
  
          &lt;meta charset="utf-8" /&gt;
          &lt;meta name="format-detection" content="telephone=no" /&gt;
          &lt;meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" /&gt;
          &lt;link rel="stylesheet" type="text/css" href="css/style.css" /&gt;
          &lt;script type="text/javascript" src="phonegap.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript" src="js/index.js"&gt;&lt;/script&gt;
          &lt;title&gt;InAppBrowser Injection Test&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div class="app"&gt;
              &lt;h1&gt;Testing Injection&lt;/h1&gt;
              &lt;div id="deviceready" class="blink"&gt;
                  &lt;p class="event listening"&gt;Starting Mother WebView&lt;/p&gt;
                  &lt;div class="event received"&gt;
                    &lt;p&gt;Device is Ready&lt;/p&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;script type="text/javascript"&gt;
              app.initialize();
          &lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And the index.js file</p>
  
  <pre><code>var app = {
  
      initialize: function() {
          this.bindEvents();
      },
  
      bindEvents: function() {
          document.addEventListener('deviceready', this.onDeviceReady, false);
      },
  
      onDeviceReady: function() {
          app.receivedEvent('deviceready');
          var ref = window.open('http://www.example.net', '_blank', 'location=yes ,toolbar=yes, EnableViewPortScale=yes');
          ref.addEventListener('loadstart', function(event) { alert('start: ' + event.url); });
          ref.addEventListener('loadstop', function() {
  
          //ref.executeScript({ code: "alert('Injected Code')" });
  
          ref.executeScript({ file: "externaljavascriptfile.js" });
          showalert();
  
          });
         ref.addEventListener('loaderror', function(event) { alert('error: ' + event.message); });
         ref.addEventListener('exit', function(event) { alert(event.type); });      
      },
  
  
      receivedEvent: function(id) {
          var parentElement = document.getElementById(id);
          var listeningElement = parentElement.querySelector('.listening');
          var receivedElement = parentElement.querySelector('.received');
          listeningElement.setAttribute('style', 'display:none;');
          receivedElement.setAttribute('style', 'display:block;');
          console.log('Received Event: ' + id);
     }
  };
  </code></pre>
  
  <p>and last the  externaljavascriptfile.js</p>
  
  <pre><code> alert('External Injected Code');
  </code></pre>
  
  <p>If I try to inject javascript code directly (i.e. uncommenting the line  "ref.executeScript({ code: "alert('Injected Code')" });" ) all works fine and the alert is triggered after the page load, but if I try to inject an external javascript (i.e. using the line "ref.executeScript({ file: "externaljavascriptfile.js" });", nothing happens.</p>
  
  <p>Am I missing something?</p>