title: Unable to enable Chrome app in iframe
body: <p>I'm trying to load the <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/nativeMessaging/" rel="nofollow noreferrer">native messaging example app</a> in an external webpage as follows:</p>
  
  <p><strong>test.html</strong></p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;iframe src="chrome-extension://knldjmfmopnpolahpmmgbagdohdnhkik/main.html"&lt;/iframe&gt;
  &lt;/body&gt;    
  &lt;/html&gt;
  </code></pre>
  
  <p>I have added the <code>web_accessible_resources</code> property in the app's manifest:</p>
  
  <p><strong>manifest.json</strong></p>
  
  <pre><code>{
    // &lt;some code snipped&gt;
    "web_accessible_resources": ["main.html"]
  }
  </code></pre>
  
  <p>However, when I use the app within test.html, I get the following error in the console, coming from a JavaScript file within the app:</p>
  
  <p><strong>Developer Console</strong></p>
  
  <blockquote>
    <p>Uncaught TypeError: Object # has no method 'connectNative'
    main.js:51</p>
  </blockquote>
  
  <p>The problematic line of code is the following:</p>
  
  <p><strong>main.js</strong></p>
  
  <pre><code>port = chrome.runtime.connectNative(hostName);
  </code></pre>
  
  <p>Here's a screenshot - the problem happens when I click on the Connect button (which calls the <code>connect</code> function):</p>
  
  <p><img src="https://i.stack.imgur.com/5XpKb.png" alt="JavaScript Error: Uncaught TypeError: Object #&lt;Object&gt; has no method &#39;connectNative&#39;"></p>
  
  <p>Obviously, this works when the app is run standalone. How can I go about loading the app in a webpage?</p>