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.
Is there a way to have pageAction defined for one website? I saw the
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
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:
Part of
manifest.json:Valid values for
matchesare exactly defined in the documentation, match patterns.Note that the match pattern in this example matches
http://example.com/and nothttp://example.com/index.html. If you want to match anything on the website, usehttp://example.com/*(appended a asterisk).Using the
chrome.tabsAPIIf you don’t want to use content scripts, you can use
chrome.tabsevents to show the page action:I recommend the content script method, unless you’re already using the
chrome.tabsAPI. Why? If you request the"tabs"permission in the manifest file, your users will see the following warning on installation: