where are the default search engine query string urls stored
I have decompressed the search.json.mozlz4 file from my Firefox Profile and found the contents to be:
{
"version": 9, "engines": [ { "id": "google@search.mozilla.orgdefault", "_name": "Google", "_isAppProvided": true, "_metaData": {} }, { "id": "wikipedia@search.mozilla.orgdefault", "_name": "Wikipedia (en)", "_isAppProvided": true, "_metaData": {} }, { "id": "bing@search.mozilla.orgdefault", "_name": "Bing", "_isAppProvided": true, "_metaData": {} }, { "id": "amazon@search.mozilla.orgde", "_name": "Amazon.de", "_isAppProvided": true, "_metaData": {} }, { "id": "ddg@search.mozilla.orgdefault", "_name": "DuckDuckGo", "_isAppProvided": true, "_metaData": {} }, { "id": "ebay@search.mozilla.orgch", "_name": "eBay", "_isAppProvided": true, "_metaData": {} }, { "id": "amazondotcom@search.mozilla.orgdefault", "_name": "Amazon.com", "_isAppProvided": true, "_metaData": {} } ], "metaData": { "useSavedOrder": false, "locale": "en-US", "region": "CH", "channel": "aurora", "experiment": "", "distroID": "", "appDefaultEngineId": "google@search.mozilla.orgdefault" }
}
I'm perplexed because I don't see any trace of search engine query strings! Where is this data stored?
Vybrané riešenie
The built-in search engine are stored in the "browser\omni.ja" archives, see:
- resource://search-extensions/
Všetky odpovede (8)
Vybrané riešenie
The built-in search engine are stored in the "browser\omni.ja" archives, see:
- resource://search-extensions/
Interesting! I noticed that the search engine urls are located in the locales files, e.g. :
{
"extensionName": { "message": "Wikipedia (en)" }, "extensionDescription": { "message": "Wikipedia, the Free Encyclopedia" }, "searchUrl": { "message": "https://en.wikipedia.org/wiki/Special:Search" }, "searchForm": { "message": "https://en.wikipedia.org/wiki/Special:Search" }, "suggestUrl": { "message": "https://en.wikipedia.org/w/api.php?action=opensearch&search={searchTerms}" }, "searchUrlGetParams": { "message": "search={searchTerms}&sourceid=Mozilla-search" }
}
Can this data be accessed from a web extension? And, what if a user wants to add a search engine that's not in the list such as github.com?
Upravil(a) Olivier de Broqueville dňa
Interesting! I noticed that the search engine urls are located in the locales files, e.g. :
{
"extensionName": { "message": "Wikipedia (en)" }, "extensionDescription": { "message": "Wikipedia, the Free Encyclopedia" }, "searchUrl": { "message": "https://en.wikipedia.org/wiki/Special:Search" }, "searchForm": { "message": "https://en.wikipedia.org/wiki/Special:Search" }, "suggestUrl": { "message": "https://en.wikipedia.org/w/api.php?action=opensearch&search={searchTerms}" }, "searchUrlGetParams": { "message": "search={searchTerms}&sourceid=Mozilla-search" }
}
Can this data be accessed from a web extension? And, what if a user wants to add a search engine that's not in the list such as github.com?
You can create a new Boolean pref named browser.urlbar.update2.engineAliasRefresh and set its value to true to make the addEngineButton (Add) button visible in "Settings -> Search". Note that you won't be able to add an icon.
See comment 18:
- 1106626 - Ability to add custom search engines by URL (non open-search and non-amo engines) [82]
See also:
You can install github as a search engine by visiting the site, right-clicking the address bar and clicking "Add Github".
You can add any site using *mycroftproject.com* or an extension like Add custom search engine.
Thank you so much for your help, cor-el. I'm not sure where I should create a new Boolean pref named browser.urlbar.update2.engineAliasRefresh. Is this in about:config or elsewhere? I also still don't know if web extensions may have access to resource://search-extensions/. I'm asking because I created an extension called Context Search and some users have been asking me if I could implement a feature to import the default search engines from Firefox. I've seen this done in another extension, but it's a bit of a hack and I'd rather avoid using hacks!
Thank you for your help zeroknight. I didn't phrase my question properly! What I meant to ask is: when a user adds a search engine that's not in the resource://search-extensions/ list, does the data for this newly added search engine get added to resource://search-extensions/ or is this a fixed read-only list. I'm trying to understand how firefox manages search engines under the hood.
The search engine list you see in resource://search-extensions/ is a fixed built-in list that can't be modified and omni.ja is protected with a META-INF file just like extensions. Search engines you add are only registered in search.json.mozlz4 in the Firefox profile folder, i.e. the XML file is no longer stored like previously was done in the searchengines folder. Importing search engines wouldn't be easy if possible as each locale has its own set.
- resource:///defaults/settings/main/search-config.json
For Firefox ESR, there is a "SearchEngines -> Add" policy to add search engines.
It's mind numbing to realise all the small details that make up Firefox! I'm also impressed by your knowledge!
Thank you again for your help.