I need to make a context menu option to search for the selected text or link. I need to be able to display text or a link in the context menu header, but only the selected text can be displayed. How can I display the link url in the title of a menu item?
the code:
function searchGoogle(info, tab) {
chrome.tabs.create({
url: "http://www.google.com/search?q=" + info.selectionText,
});
}
chrome.contextMenus.create({
title: "Search %s",
contexts:["link", "selection"],
});
source
share