Google-chrome – way to get Chrome to use a %20 instead of a + sign for spaces when using keyword search

google-chrome

I would like to use Chrome's keyword search omnibox functionality to search a website which is not available to the public. When you type a search term with spaces in it in the website, the URL that gets produced looks like this:

https://example.com/default.aspx?view=slg/search#txt=My%20search%20%with%20spaces

Unfortunately when I type a search using the keyword in Chrome's omnibox, I get this:

https://example.com/default.aspx?view=slg/search#txt=My+search+with+spaces

Previous questions of Super User have had the opposite occur. That is the omnibox has converted their spaces to a %20 instead of a +. This answer indicates that chrome guesses which to use. Does anyone know of a way to hint to Chrome that it should use a %20 instead of a +?

Best Answer

I never found a way to do this, so I ended up writing an open source extension for Chrome. I'll warn you, it is hard coded to the https://privatewebsite.com/, so you won't be able to Ctrl+C, Ctrl+V it for your needs, but it is available under the MIT license for you to use as necessary.

I think the most important aspect of what I did was to use the encodeURIComponent(searchText) javascript function to get the %20's I needed.