“Crome Extension ContextMenus” Respostas de código

Chrome.Contextmenus

function getword(info,tab) {
  console.log("Word " + info.selectionText + " was clicked.");
  chrome.tabs.create({  
    url: "http://www.google.com/search?q=" + info.selectionText
  });
}
chrome.contextMenus.create({
  title: "Search: %s", 
  contexts:["selection"], 
  onclick: getword
});
aus ogola

Crome Extension ContextMenus

chrome.runtime.onInstalled.addListener(function() {
    chrome.contextMenus.create({
        "title": 'Search Google for "%s"',
        "contexts": ["selection"],
        "id": "myContextMenuId"
    });
});
    
chrome.contextMenus.onClicked.addListener(function(info, tab) {
    chrome.tabs.create({  
        url: "http://www.google.com/search?q=" + encodeURIComponent(info.selectionText)
    });
})
aus ogola

Respostas semelhantes a “Crome Extension ContextMenus”

Perguntas semelhantes a “Crome Extension ContextMenus”

Mais respostas relacionadas para “Crome Extension ContextMenus” em JavaScript

Procure respostas de código populares por idioma

Procurar outros idiomas de código