Created
November 22, 2013 22:25
-
-
Save lyoshenka/7607911 to your computer and use it in GitHub Desktop.
Chrome Extension to stop Chrome from trying to search when going to a URL with .localhost domain.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| chrome.tabs.onUpdated.addListener(function(tabId, e) { | |
| if (e.url && e.url.match('google.com/search') && e.url.match('localhost')) { | |
| var q = e.url.match(/q=[^&]+&/i); | |
| if (q) { | |
| var localUrl = decodeURIComponent(q[0].substring(2,q[0].length-1)); | |
| chrome.tabs.update(tabId, {url: 'http://' + localUrl }); | |
| } | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "Chrome Localhost Search Blocker", | |
| "version": "1", | |
| "description": "Stops Chrome from trying to search when going to a URL with .localhost domain.", | |
| "permissions": ["webNavigation", "tabs", "http://*/*", "https://*/*"], | |
| "background": { | |
| "scripts": ["chromeSearchFix.js"] | |
| }, | |
| "manifest_version": 2 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment