// from select and translate chrome extension chrome.contextMenus.create({title: "Add or Remove languages", contexts:["selection"], onclick: options}); function options(info) { var options = null; if (!info.linkUrl || info.linkUrl.lenght == 0) { options = info.selectionText; ///// <<<<<<------- there's the selection magic } chrome.tabs.create({url: "options.html" }); }