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

  • SEARCH
  • Home
  • 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 6647129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:30:02+00:00 2026-05-26T00:30:02+00:00

Google Chrome Extensions Message Passing Problem : In this Chrome Extension My Popup Page:

  • 0

Google Chrome Extensions Message Passing Problem :

In this Chrome Extension

My Popup Page:

chrome.browserAction.onClicked.addListener(getMessage);
getMessage();

function getMessage()
{
    chrome.tabs.getSelected(null, function(tab) {
        chrome.tabs.sendRequest(tab.id, {greeting: "hello"}, function(response) {
            console.log(response.farewell);
        });//getting response from content script
    });
}

My Script Page :

chrome.extension.onRequest.addListener(
  function(request, sender, sendResponse) {
    if (request.greeting == "hello")
      sendResponse({farewell: "goodbye"});
    else
      sendResponse({}); 
  });

I am not getting any response from the content script.

Edits:

As per @serg , i have moved the code to the background page. But still, it is not working

  • 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-26T00:30:03+00:00Added an answer on May 26, 2026 at 12:30 am

    You can’t have chrome.browserAction.onClicked listener if you have popup page attached to the browser action button, it won’t fire.

    • Remove popup, leave only button
    • Move everything into background page.
    • Replace tab.id with null.
    • Remove createFile(); call at the beginning as it won’t do anything in this case (content script isn’t ready to listen yet).
    • Don’t use alerts for debugging extension, use console.log().
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a very specific question for a Google Chrome extension. http://www.meebo.com/mobile/ This page
Having a problem while passing messages using content scripts in Google chrome extension dev
I have read and re-read this page, as well as run the samples: http://code.google.com/chrome/extensions/background_pages.html
I included some adsense code in my google chrome extension popup file. Unfortunately this
I looked at the google-chrome-extension labs page and I don't see any example where
Google chrome doesn't behave the same as other browsers when encountering this nugget: <?php
I want to use google chrome as a control. I think Enso does this
Google Chrome extensions are a nice invention, but they can potentially interact with a
Google Chrome is using alpha numeric hashes as identifiers for the Chrome extensions. For
I am working on creating a Google Chrome extension. We have it included in

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.