0

I am new to Chrome Extension. I have a project to create a chrome extension that can help our web app to communicate with other team's desktop applications.

So I know I need to use native messaging, so I need to create a native host. But I am confused about where I should keep the native host? Can it be packed with the chrome extension? So when I publish the extension, the other team can install the extension, then they will have the native host?

Or I need to zip the native host app, and send it to the other team?

Also, the examples about native messaging I found so far are all for Chrome Manifest V2, is there any example for native messaging in Manifest V3? What should I put into host_permission for nativeMessaging? I put nativeMessaging in Manifest V3 and it gave me an error.

Tian Qin
  • 153
  • 1
  • 3
  • 15
  • You cannot distribute native messaging hosts from Chrome web store. They have to be manually downloaded and installed by users – Asesh Aug 28 '22 at 05:00
  • So in order for other teams to have the ability to communicate to our web app. They need to download the whole extension and native host together? I thought I will publish an extension to chrome extension, so users can just find the extension in chrome store, then they only need to download the native host, is that right? – Tian Qin Aug 28 '22 at 05:26
  • @wOxxOm has answered your question – Asesh Aug 28 '22 at 06:29

1 Answers1

0

The host app is a separate download on a separate [public] server.

  1. The users will install the extension from the web store.
  2. The extension tries chrome.runtime.connectNative, and on failure it opens a page showing how to download the app from some external URL and how to install/register it.

ManifestV3 doesn't change anything for nativeMessaging. There's nothing it needs in host_permissions: the term host here means site. To adapt the examples you'll only need to change a couple of fields as explained in the migration guide.

wOxxOm
  • 65,848
  • 11
  • 132
  • 136
  • When I tried to migrate to V3, it gave me an error saying failed to load backgound.js. Because of this, I am also not able to inspect the background.js to debug this. Any ideas? – Tian Qin Aug 29 '22 at 22:10
  • Please show your manifest.json and background.js in a new question. – wOxxOm Aug 30 '22 at 05:47