1

I have a Chrome extension communicating with my Windows application by Native Messaging. However there is case that user installs extension, but doesn't have application installed. In this case there is a runtime error (Unchecked runtime.lastError: Specified native messaging host not found.) appeared in my extension in chrome://extensions list when extension calls chrome.runtime.connectNative(). Is there any way to avoid this error message?

5
  • It doesn't exist. Commented Jan 26, 2023 at 10:11
  • 1
    As the error message says you need to check chrome.runtime.lastError in the callback of connectNative. Commented Jan 26, 2023 at 10:33
  • but according to developer.chrome.com/docs/extensions/reference/runtime/…, it does not have a callback Commented Jan 26, 2023 at 14:04
  • 2
    @SantK - You are correct, chrome.runtime.connectNative doesn't have a callback. But it always returns a Port object, even if there's an error. And you can attach callbacks to the port's onDisconnect and onMessage events. An error during connection causes an onDisconnect event. Commented Jan 26, 2023 at 15:18
  • Example: How do I find out if connectNative failed or succeeded Commented Jan 26, 2023 at 20:57

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.