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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:33:40+00:00 2026-06-11T07:33:40+00:00

I have problem with developing chrome-extensions. I have content script: window.addEventListener(load,function(){ var html =

  • 0

I have problem with developing chrome-extensions.

I have content script:

window.addEventListener("load",function(){
   var html = document.getElementsByTagName('html')[0];
   var title = document.getElementsByTagName('title')[0].innerHTML;
   if(html){
      chrome.extension.sendRequest({akce: 'content', title: title},function(response){});
      alert(title);
   }
},false);

then I have a BG page:

chrome.extension.onRequest.addListener(function(request,sender,sendResponse){
    if(request.akce == 'content'){
        console.log(request.title);
    }
});

The problem is that when I start typing to address bar, my content script is loaded on the site which is first in autocomplete list. As you can see in the screenshot below, the content script is loaded before I hit enter in address bar and is loaded on the site where I am not yet.

I have no idea what is happening. Please, please help me.

screenshot

  • 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-06-11T07:33:42+00:00Added an answer on June 11, 2026 at 7:33 am

    Solution is injected script from background page.

    Example: get referrer from bg page

    chrome.tabs.executeScript(tabId,{
        code: "chrome.extension.sendRequest({action: 'content_refer', url: document.referrer},function(response){});"
    });
    
    chrome.extension.onRequest.addListener(function(request,sender,sendResponse){
        if(request.action == 'content_refer'){
            wipstats.allPages[sender.tab.id].ref = request.url;
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem developing with live555. I already build the lib-files and example projects
i have a problem i am developing an asp.net mvc project. Website is in
I'm developing small FTP upload app. for mac (10.6 if it matters) Have problem
I have been developing the application for drawing, and I have the problem: my
I'm developing an Eclipse plug-in and I have a problem which is reproduced here:
I have a problem linking an application for an embedded target. I'm developing on
I have this problem and it's drivin' me nuts! So I am developing my
I'm developing an Android application with a spinner. I have this problem: This is
I have a little Problem with the app that I'm developing. In the App
I'm developing an app and have run into a problem with asynchronous calls... Here's

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.