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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:22:46+00:00 2026-06-16T02:22:46+00:00

Is there a way to have pageAction defined for one website? I saw the

  • 0

Is there a way to have pageAction defined for one website? I saw the samples and both of them use background.js to show chrome.pageAction.show(tabId) in that file.

  • 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-16T02:22:48+00:00Added an answer on June 16, 2026 at 2:22 am

    To show a pageAction for a specific website, two methods exist.

    Using a content script

    Run the content script at the specific website, and pass a message to the background requesting the page action:

    // contentscript.js
    chrome.extension.sendMessage('showPageAction');
    // background.js
    chrome.extension.onMessage.addListener(function(message, sender) {
        if (message == 'showPageAction') {
            chrome.pageAction.show(sender.tab.id);
        }
    });
    

    Part of manifest.json:

    "content_scripts": [{
        "js": ["contentscript.js"],
        "run_at": "document_start",
        "matches": ["http://example.com/"]
    }]
    

    Valid values for matches are exactly defined in the documentation, match patterns.
    Note that the match pattern in this example matches http://example.com/ and not http://example.com/index.html. If you want to match anything on the website, use http://example.com/* (appended a asterisk).

    Using the chrome.tabs API

    If you don’t want to use content scripts, you can use chrome.tabs events to show the page action:

    // background.js
    chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
        if (changeInfo.url == 'http://example.com/') {
            chrome.pageAction.show(tabId);
        }
    });
    

    I recommend the content script method, unless you’re already using the chrome.tabs API. Why? If you request the "tabs" permission in the manifest file, your users will see the following warning on installation:

    Install <name of your extension>?
      It can access:
      Access your tabs and browsing activity

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

Sidebar

Related Questions

Is there any way to have a default MessageBox.Show() caption? Let says I would
Is there a way to have an SQL Server XML return use CDATA? I
Is there a way to have controls/images/etc out of the Window/Chrome (ie, Aero's glass)
Is there a way to have something like this: .class1, .class2 { background: green;
Is there a way to have a sequence of animations, one following the other
Is there a way to have a windows form app hosted in IE use
Is there a way to have one column equal the count of all the
Is there any way to have a method return any one of a number
is there a way to have comments box on a website made on Apple's
Is there a way to have custom defined friendly URLs with WCF without IIS?

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.