Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6783349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:51:11+00:00 2026-05-26T16:51:11+00:00

I am using the following code to send a sample message from the content

  • 0

I am using the following code to send a sample message from the content script:

function sendjsontrue()
{

        var arrCars = new Array("Toyota", "Mercedes", "BMW");           
            jsonStr = JSON.stringify(arrCars);
        chrome.extension.sendRequest({greeting: jsonStr},     function(response){
            console.log(response.farewell);
            });
        console.log("Message with header=greeting has been sent...");
}

The code in my popup.html to handle the message sent by content script, is given below–

<script>
chrome.extension.onRequest.addListener(
  function(request, sender, sendResponse) {
    console.log(sender.tab ?
            "from a content script:" + sender.tab.url :
            "from the extension");
  if (request.greeting == "hello")
      sendResponse({farewell: "goodbye"});
  else
      sendResponse({notfarewell:"Not goodbye"}); .
  });

</script>

The error that I am getting is given below–

Port error: Could not establish connection. Receiving end does not exist.
chrome/EventBindings:184Error in event handler for 'undefined': TypeError: Cannot read     property 'farewell' of undefined
at chrome-extension://nkmkgjckmjekpbghhildcfdlnbjeglkd/obtainformdata.js:81:25
at chrome/RendererExtensionBindings:238:13
at [object Object].dispatch (chrome/EventBindings:182:28)
at Object.<anonymous> (chrome/RendererExtensionBindings:134:27)

What have I done wrong here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:51:11+00:00Added an answer on May 26, 2026 at 4:51 pm

    You should write the receiver code in a background page, instead of at the popup. Content scripts communicate with the background page, by default.

    If you’re in need of decent documentation, have a look at:

    • Chrome extension methods
    • Background pages
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code in javascript: <script type=text/javascript src=#{facesContext.externalContext.requestContextPath}/js/sample-points.js></script> <script type=text/javascript>//<![CDATA[ var cloudmade
I am using following code in rowdatabound function. Protected Sub gvwMileStone_RowDataBound(ByVal sender As System.Object,
I'm using following code but cannot return data from MySQL. This is the output:
I open a pop-up window using following code in main.html function openwindow(url) { window.open(url,
Using the following code, I'm retrieving a list of Integers from a DB and
Using the following code: Private Sub MakeMeSomeXmlBeforeRyanGetsAngry() Dim db As New MyDBDataContext Dim customer
Im using the following code to output all the nodes from the xml shown.
I am using the following code to send out a Multipart/Alternative HTML and Plain
I am using following code to check whether a check box on my website
I am using following code to design my home page. The output (as shown

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.