Page popup action

I am making a chrome extension that uses pageAction.

I can set when it shows if I want it to have a popup or handle the click itself.

What I want to do is handle the click itself, but with certain scenarios I don’t want to process the normal code and want to show the user a message. Preferably with a popup.

But these are the seams I can either make pageAction have a popup, or have onClick. But not both.

I can show a warning, but it's ugly.

+5
source share
2 answers

"" . . , Google .

, , . pageAction :

:

function init() {
  if (getClickBehaviour() == 'popup')
    handlePopup();
  else
    openPage();
}

function getClickBehaviour() {
  return localStorage['CLICK_BEHAVIOR'] || 'popup';
}

function openPage() {
    chrome.tabs.create({url: 'http://google.ca'});
    window.close();
  });
}

init();

, . - , .

, " ", , . .

+3

, , (chrome.pageAction.setPopup('')) , . , onClicked ( ), .

, . ( , , , .)

0

All Articles