Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

393
Views
Sending message from a page to Chromium (Edge) extension returns an error

There're a number of similar questions here, but none of them seem to apply to sending messages from a regular web page directly to an extension.

Chrome docs state that this is possible without using content scripts.

I've allowed external callers in manifest.json:

  "externally_connectable": {
    "matches": [
      "http://localhost/*",
      "http://host.local/*"
    ]

But performing a call as follows yields Uncaught Error: Attempting to use a disconnected port object:

port = chrome.runtime.connect(editorExtensionId);
port.postMessage(editorExtensionId, { connect: true },
    function (response) {
        console.log(response.message);
    });

On the other hand, sending messages directly works via chrome.runtime.sendMessage(editorExtensionId, ...) , but in this case I can only reply once, as there's no port with a longer lifetime.

Inside the extension - in background.js - I'm using chrome.runtime.onMessageExternal.addListener. Strangely, I usually get another error message after the first one: Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.

The page is hosted on http://host.local in both cases.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!