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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:31:00+00:00 2026-05-30T01:31:00+00:00

I am currently working on a web add-on that does certain things depending on

  • 0

I am currently working on a web add-on that does certain things depending on what site you are currently on. The add-on works fine when I go to a webpage from the URL bar like for instance yahoo.com, but when I try to make the javascript run from any other page on yahoo it doesn’t run. The code I am using is:

        if(document.URL.search("yahoo.com")>=0){
            var scriptYahoo = document.createElement('script');
            scriptYahoo.type='text/javascript';
            scriptYahoo.src='http://localhost:8001/yahooChrome.js';
            body.appendChild(scriptYahoo);          
        }

I am under the impression that the URL.search will look throughout the entire URL and come back true if it finds it anywhere in the URL. If someone could just try to let me know why this only works when you are going to yahoo.com and not any other site navigated to inside of yahoo.com.

I have narrowed it down a bit and realized that the file that they are located in does not even get called whenever the pages are loaded. It does get called though when I just go to some random other webpage.

—–EDIT—–

I apologize for my lack of complete knowledge of what is going on, I am taking over this code from another developer and don’t really know exactly what is going on yet. What I have discovered is that if this code were just simply run it would return every website with yahoo.com in the URL. This is never getting called at any point though. I have this function here to see if a tab has been modified at all:

    chrome.tabs.onUpdated.addListener(check);
//chrome.tabs.onClicked.addListener(test);

function check(tab_id,data,tab){    

        console.log("updated"); 
        if (data.status == "complete")
            {
                chrome.tabs.sendRequest(tab.id, {greeting: "hello"}, function(response) {
                console.log(response.farewell); });
            }
};    

If I put an alert in here anywhere in the function it will always hit no matter what page is being loaded. When I get over to my onRequest function though it does not hit if it is some variation of yahoo.com

chrome.extension.onRequest.addListener(
          function(request, sender, sendResponse) { 
            console.log(sender.tab ?"from a content script:" + sender.tab.url :"from the extension");
            trackInfo();
            setTimeout("init();", 2000); //wait till the page got loaded
            if (request.greeting == "hello")
              sendResponse({farewell: "goodbye"});
            else
              sendResponse({});             
          });   

So at this point I am not sure why it would stop catching all the variations inside of the function. Thanks again for the help it’s much appreciated.

  • 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-30T01:31:01+00:00Added an answer on May 30, 2026 at 1:31 am

    I figured it out, I simply needed to do:

    "matches": ["http://*/*","https://*/*"],
    

    instead of:

    "matches": ["http://*","https://*"],
    

    in my manifest file and it fixed all of my issues.

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

Sidebar

Related Questions

I'm currently working with web services that return objects such as a list of
I am currently working on an web application that uses ASP.NET 2.0 framework. I
I am currently working on a web application that uses PHP and MySQL, but
Hello Ruby/Rails/Merb developers! Im currently working on a web project that will have a
I'm working on a web app that reads data from a set of text
I'm currently working with a part of my application that uses Dynamic Web User
I am currently working on a mobile web page in asp.Net MVC2 that allows
I am currently working on an advanced web application that contains a number of
I'm currently working on a web application that's sort of similar to Google Reader
I'm currently working on web application using VB in ASP.NET. Right now I have

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.