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 7031909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:51:54+00:00 2026-05-28T00:51:54+00:00

My Requirement is whenever I click on the Extension Icon that should send a

  • 0

My Requirement is whenever I click on the Extension Icon that should send a Request to content script and that should send reply with required properties. I am able to send the request. And when I check console Content script is recieving the request and processing it.But At popup side I could not receive anything.
Here is the request handler in Content script

chrome.extension.onRequest.addListener(function ListeningMethod(request, sender, callback)
{
    switch(request.action)
    {
        case "QuestionProperties":
            sendResponse({attributes: {"h":"s","r":"t"} });
        break;
    }
});

And on popup.html I am sending the request like this

$(document).ready(function(){
        chrome.tabs.getSelected(null, function(tab) {
            chrome.tabs.sendRequest(tab.id, {action: "QuestionProperties"}, function(response){
                alert('received something'); // Even this is not alerting
                                    var data = JSON.parse(response.attributes);
                alert(JSON.stringify(data)); // Here also I could not recieve anything.  At Contentscript side I have checked the response that is being sent. I am able to see the data. But at Popup side I am unable to recieve it. Please help me on this. 
            });
        });
 });
  • 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-28T00:51:55+00:00Added an answer on May 28, 2026 at 12:51 am

    Your content_script isn’t calling the correct method to send the response. Your listener function is naming it callback but then trying to use sendRequest. You should also either remove the function name or define it outside of the addListener for clarity.

    chrome.extension.onRequest.addListener(function(request, sender, callback)
    {
        switch(request.action)
        {
            case "QuestionProperties":
                callback({attributes: {"h":"s","r":"t"} });
            break;
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the requirement that whenever there is a model get's added/changed/deleted, it should
Requirement : Should update MySQL database with that of MS Sql Server updates which
My Requirement is, in first xaml page place all the images .if whenever click
In my app there is a requirement that it should display a specific landscape
I Am working now on IE AddOns... my requirement is that whenever i double
This is the requirement: whenever a new word is encountered, the program should allocate
Requirement : In an app, During the first launch it is required to download
Current requirement is on button click I am getting a json data through ajax
My requirement is parts of text should be displayed as bold and colored within
I am Having requirement on WPF Datagrid row,Whenever user selects a DatagridRow,corresponding datagrid Cells

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.