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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:58:15+00:00 2026-05-23T08:58:15+00:00

I am writing an extension for Google Chrome. The content script never sees that

  • 0

I am writing an extension for Google Chrome. The content script never sees that sendNextProfile request has been sent from background page. At least, the message RECEIVED REQUEST FOR NEXT PROFILE never appears on the console log and no new request is seen by background.

HERE IS THE CODE FROM THE CONTENT SCRIPT

//send request for first profile
var currentProfile=0;
chrome.extension.sendRequest({cmd: "openProfile", url: profileLinks[currentProfile]});

//listen for request to send next profile
chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
    if(request.cmd == "sendNextProfile") {
        console.log("RECEIVED REQUEST FOR NEXT PROFILE");
        ++currentProfile;
        chrome.extension.sendRequest({cmd: "openProfile", url: profileLinks[currentProfile]});
    }
});

HERE IS THE CODE FROM THE BACKGROUND PAGE

//detect when message tab is closed and request new profile
//var closedTabId=null;
chrome.tabs.onRemoved.addListener(function(tabid, removeInfo) { 
    console.log("TAB CLOSED "+tabid);
    if (tabid==msgTabId) {
        chrome.extension.sendRequest({cmd: "sendNextProfile"});
        console.log("REQUESTED NEW PROFILE");
    }   
});

On the background side, the console message appear as expected, so it appears the request is send. So what’s up with this code?

  • 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-23T08:58:16+00:00Added an answer on May 23, 2026 at 8:58 am

    Instead of:

    chrome.extension.sendRequest({cmd: "sendNextProfile"});
    

    it should be:

    chrome.tabs.sendRequest(tabId, {cmd: "sendNextProfile"});
    

    But if your tab is removed there is no point in sending request to that tab as it doesn’t exist already. Maybe you need to send it to some other tab?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a google chrome extension that uses chrome.pageCapture.saveAsMHTML(object details, function callback) function callback
I'm writing a Google Chrome extension that needs to do a lot of things
I'm writing a Google Chrome extension. As the JavaScript files are loaded from disk,
I am writing a Google extension. Here my content script modifies a page based
I'm writing a Google Chrome extension that finds all titles on pages like this
I'm writing a Google Chrome extension which manipulates the current page (basically adds a
Is it possible to access Google Chrome's cache from within an extension? I'd like
I'm writing a small Chrome extension to manipulate Google's search results' DOM to add
I am writing an page action extension for Google Chrome. The extension injects the
I am writing a Google Chrome Extension and trying to make the transition to

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.