Skip to content

Instantly share code, notes, and snippets.

@kevinashworth
Created March 12, 2020 18:32
Show Gist options
  • Save kevinashworth/35e68bfefafe22de815e5da28c63c0f4 to your computer and use it in GitHub Desktop.
Save kevinashworth/35e68bfefafe22de815e5da28c63c0f4 to your computer and use it in GitHub Desktop.
/* Bookmarklet to Google Search the current site for a word or phrase. WIP. */
// h = location.href;
// url = new URL(h);
// tld = url.host;
// qs = prompt('Google Search on this site for:');
// gs = `https://www.google.com/search?q=site%3A${tld}+${qs}`;
// window.location = gs;
javascript:h%20=%20location.href;url%20=%20new%20URL(h);tld%20=%20url.host;qs%20=%20prompt(%27Google%20Search%20on%20this%20site%20for:%27);gs%20=%20`https://www.google.com/search?q=site%253A${tld}+${qs}`;window.location%20=%20gs;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment