views:

19

answers:

1

this works fine in browserAction.. but when i switch it pageAction.. even the icon doesnot show up

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>

manifest.json

{
  "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"
    }
  ]
}
A: 

Well for pageAction, you would need to enter another manifest property:

{
  "name": "My extension",
  ...
  "page_action": {
    "default_icon": "icons/foo.png", // required
    "default_title": "Do action",    // optional; shown in tooltip
    "default_popup": "popup.html"    // optional
  },
  ...
}

Then you need to either hide or show.

chrome.pageAction.show(integer tabId)
Mohamed Mansour

related questions