Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome Extension - Modify Right-Click Browser Action Menu

I am wondering if I am able to modify the right-click menu of the browser action menu? I want to add an option titled 'Logout'.

like image 758
Jon Avatar asked Mar 25 '12 20:03

Jon


2 Answers

For the context Chrome says:

Value must be one of: [all, page, frame, selection, link, editable, image, video, audio, launcher, browser_action, page_action]

So use

chrome.contextMenus.create({
  "title": "Logout",
  "contexts": ["browser_action"],
  "onclick": logout
});

Where logout() is the function that will be called when you click on it. (And enable "contextMenus" permission in the manifest.)

Edit: A bit of warning, if you have an Event page, using onclick attribute is not supported and you should add a chrome.contextMenus.onClicked handler instead.

like image 155
user4139284 Avatar answered Sep 24 '22 09:09

user4139284


No you cant do that, youll need to stick it in the browser actions popup.

like image 33
PAEz Avatar answered Sep 24 '22 09:09

PAEz