2
\$\begingroup\$

Functions and features: paste/type search keywords to go straight to google.com search results pages - explicitly google.com NO google.TLD

chrome.webRequest.onBeforeRequest.addListener( function (details) { var requestURL = details.url; var re = new RegExp('^(http(?:s)?):\/\/www\.google\.(?:(?!com\/)[a-z]+\.?[a- z]+)?/', 'gi'); return { redirectUrl: requestURL.replace(re, '$1://www.google.com/') }; }, {urls: ['<all_urls>']}, ['blocking'] );

Extension metadata

{ "name": "__MSG_appName__", "description": "__MSG_appDescription__", "version": "1.0.0.0", "manifest_version": 2, "default_locale": "en", "icons": { "128": "icon.png" }, "homepage_url": "https://", "background": { "scripts": [ "omnibox-ncr.js" ] }, "permissions": [ "webRequest", "webRequestBlocking", "*://www.google.*/*" ] } 

Concerns

  • Performance and efficiency
  • Functionality
  • Does it effectively keep searches at google.com NOT google.TLD (without setting your google.TLD cookie)?
\$\endgroup\$
3
  • \$\begingroup\$ I feel like you should be a little more wordy in your questions. Like, make sentences, you aren't really limited on word count. It will make people want to answer your question :) \$\endgroup\$ Commented Aug 25, 2017 at 17:35
  • \$\begingroup\$ Well I allready sorted this out, however I'm sure I could get my regexp to be even more efficient. \$\endgroup\$ Commented Sep 6, 2017 at 13:49
  • \$\begingroup\$ Also I'm looking a way to save that regexp to chrome.storage.local but seems there are no advanced guides. \$\endgroup\$ Commented Sep 6, 2017 at 14:40

0

You must log in to answer this question.