14

In Chrome, you can highlight some text on a web page and use the right-click context menu to open a google search for the selected text in a new tab.

It would be super convenient if I could access this feature using a keyboard shortcut instead of the right-click menu. I've tried searching for existing extensions and also scoured the list of existing keyboard shortcuts here: https://support.google.com/chrome/answer/157179?hl=en

Does anybody know a way to accomplish this?

migrated from webapps.stackexchange.com Jan 25 '15 at 20:02

This question came from our site for power users of web applications.

  • Questions about web browser functionality belong on Super User. – ale Jan 25 '15 at 19:27
9

This will work while in Chrome:

  • First highlight some text
  • Hit CTRL+C - This copies the text
  • Hit CTRL+T - This creates a new tab and makes it the focus
  • Hit CTRL+V - This pastes the text in the Omnibox (Chrome defaults the cursor there)
  • Hit Enter - This will search the text in the Omnibox

Want to automate it? Use AutoHotKey to make it an automatic macro using CTRL+Alt+S Use this script::

^!s::
  Send ^c
  Send ^t
  Send ^v
  Send {Enter}
Return

FYI, I tested this script and it works in Chrome.

5

I have two answers for this in AHK as well.

This is global applicable anywhere (not only in chrome). Just select text and press Windows+G

#g::  ;;Google selected text
   Send, ^c
   Run, http://www.google.com/search?q=%Clipboard%
Return

One is this from my answer here. Select Text and press Windows+Shift+G. This is different in that it just gives you a link on the clipboard.

; Search google for the highlighted word
; then get the first link address and put it on the Clipboard

^!r:: Reload

#+g::
    bak = %clipboard%
    Send, ^c
    ;clipboard = %bak%`r`n%clipboard%
    Query = %clipboard%
    wb := ComObjCreate("InternetExplorer.Application")
    ;wb := IEGet()
    wb.Visible := false
    wb.Navigate("www.google.com/search?q=" Query)
    While wb.readyState != 4 || wb.document.readyState != "complete" || wb.busy ; wait for the page to load
      sleep 100
    ; loop % (Nodes := wb.document.getElementById("rso").childNodes).length
    ;     Links_urls .= (A_index = 1) ? Nodes[A_index-1].getElementsByTagName("a")[0].href : "`n" . Nodes[A_index-1].getElementsByTagName("a")[0].href
    ; Msgbox %Links_urls%

    Nodes := wb.document.getElementById("rso").childNodes
    First_link := Nodes[0].getElementsByTagName("a")[0].href
    Clipboard = %First_link%
    TrayTip, First Link on Google Search, %First_link% `r`n Ctrl+V to paste the link
return
  • The first option gives me the LAST ctrl + c or win + g. I'm not certain why? – josh Jan 12 '17 at 10:56
  • You have to select the text first. That's the only reason I can think of getting the last clip or are you using a clipboard manager? or try adding this to your script after the Send, ^c command to see what's on your clipboard TrayTip, Clipboard Contents, %clipboard% rn – Parivar Saraff Jan 31 '17 at 4:27
0

This extanstion can help you:
https://chrome.google.com/webstore/detail/searchbar/fjefgkhmchopegjeicnblodnidbammed
After instaling mark those options:
*Open search results in a new tab by default (does not affect hotkeys; press Ctrl or middle-click to toggle new tab)
*Open new tabs in the foreground by default (press Shift to toggle between foreground and background)
Now you are able to run search for selected text with Ctrl+Shift+Alt+G shortcut

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.