How to change the search provider for Firefox OS phones from Bing to Google

One of the great things about having the source code to your phone’s operating system is that you can change your phone’s behaviour in ways you wouldn’t be able to otherwise.

For example, on my Geeksphone Peak the default search provider in the browser is Bing. I’d like to switch this to Google because I like Google’s search results better. Currently this isn’t a user-configurable option in the phone’s settings (although this might change soon), but it’s possible to change nonetheless.

It turns out to be relatively simple to do this, at least once you’ve got a workflow set up to build Gaia, the Firefox OS user interface. In the source tree for you’ve grabbed from github, find and edit the file gaia/apps/browser/js/browser.js and change:

DEFAULT_SEARCH_PROVIDER_URL: 'm.bing.com',
DEFAULT_SEARCH_PROVIDER_TITLE: 'Bing',
DEFAULT_SEARCH_PROVIDER_ICON: 'http://bing.com/favicon.ico',

to:

DEFAULT_SEARCH_PROVIDER_URL: 'www.google.com',
DEFAULT_SEARCH_PROVIDER_TITLE: 'Google',
DEFAULT_SEARCH_PROVIDER_ICON: 'https://www.google.com/favicon.ico',

Then simply build (./build.sh gaia) and flash (./flash.sh gaia) Gaia to the phone. After the flash is complete, you should find the default search is now Google.com:

Firefox OS with Google as Default Search

Comments

UBi's picture
UBi on May 16, 2013 - 13:30 Permalink

Since it’s all HTML/CSS/JS: shouldn’t it suffice to transfer the browser zip file to your desktop computer, unzip it, modify browser.js, re-zip it, and put it back in place? Rebuilding and flashing complete gaia seems like huge overhead to me.

Maiko Engelke's picture
Maiko Engelke on May 20, 2013 - 14:09 Permalink

Unfortunately, yes and no. The file can be found in
/system/b2g/webapps/browser.gaiamobile.org/applica…

you can adb pull it, change, but you can’t push it back, because it’s a read only system. chmod won’t work either.

Fabrice's picture
Fabrice on May 20, 2013 - 19:42 Permalink

You have to run |adb remount| before pushing to remount the /system partition in read-write mode.

Mathieu's picture
Mathieu on May 26, 2013 - 12:51 Permalink

Thanks for posting this. I’m new to FirefoxOS (and the android-ish adb stuff), but the following worked for me:

adb pull /system/b2g/webapps/browser.gaiamobile.org/applica…

After decompressing the file, the confs are in ./js/browser.js as you mentioned, but it seems to get compiled into ./gaia_build_defer_index.js, so I had to change both.

Then re-zip to push back:

adb remount
adb push application.zip /system/b2g/webapps/browser.gaiamobile.org/applica…
adb reboot

Diclaimer: I am just randomly poking around FirefoxOS, use at your own risk :)

Rui Seabra's picture
Rui Seabra on June 1, 2013 - 10:33 Permalink

Hey, Mathieu, thank you very much for that helpful hint. Thanks to it I wrote a script to automate those steps and one can fetch it from my blog entry here: http://blog.1407.org/2013/06/0…