Google chrome chrome browserAction到pageAction

Google chrome chrome browserAction到pageAction,google-chrome,Google Chrome,这在browserAction中效果很好。。 但当我切换到pageAction时。。即使是图标也不会出现 background.html <html> <head> <script> // Called when the user clicks on the browser action. chrome.browserAction.onClicked.addListener(function(tab) {

这在browserAction中效果很好。。 但当我切换到pageAction时。。即使是图标也不会出现

background.html

<html>
    <head>
    <script>
      // Called when the user clicks on the browser action.
      chrome.browserAction.onClicked.addListener(function(tab) {
        chrome.tabs.create({'url':'http://google.com/search?q=site:'+window.location.host});
      });

    </script>
    </head>
    </html>

对于pageAction,您需要输入另一个清单:

那么你需要选择或

{
  "name": "linkcheck",
  "description": "check link.",
  "version": "1.1.1",
  "

background_page": "background.html",
  "permissions": ["tabs", "http://*/*","https://*/*"],
  "browser_action": {
    "name": "linkcheck",
    "default_icon": "icon.png"
  },
  "icons": {
      "128": "icon128.png",
      "48": "icon48.png"             
   },  

  "content_scripts": [
    {
      "matches": ["https://www.google.com/*"],
      "js": ["myscript.js"],
      "run_at": "document_end"
    }
  ]
}
{
  "name": "My extension",
  ...
  "page_action": {
    "default_icon": "icons/foo.png", // required
    "default_title": "Do action",    // optional; shown in tooltip
    "default_popup": "popup.html"    // optional
  },
  ...
}
chrome.pageAction.show(integer tabId)