Chrome Native Native Messaging Api: How to open native applictaion(.exe) per tab

1.4k views Asked by At

Hi I am converting my NPAPI plugin to native Messaging app. I have gone through http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/nativeMessaging/ In this example native app(.exe) is launched per tab. But in my case it is launched only once for chrome. Here is the my manifest.json.

{
   "background": {
      "page": "background.html"
   },
   "content_scripts": [ {
      "all_frames": true,
      "js": [ "contentscript.js" ],
      "matches": [ "http://*/*", "https://*/*" ],
      "run_at": "document_idle"
   } ],
   "description": "Native Messaging api",
   "key": "MIIBIjANBgkqhkiG9w0BAQEFAAO",
   "manifest_version": 2,
   "name": "Test Extension",
   "permissions": [ "tabs", "http://*/*", "https://*/*", "nativeMessaging" ],

}

here is the background.html:

<html>
   <head>
     <title></title>
   </head>
  <body>
     <script src="background_pg_helper.js"></script>
  </body>
</html>

I can launch my native application only inside "background_pg_helper.js" by calling

var hostName = "com.google.chrome.example.echo";
port = chrome.runtime.connectNative(hostName);

Which is a single instance.

I want to launch my native application as per tab so that one .exe can manage one tab. how should i do this?

0

There are 0 answers