Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save saicharanreddyk/79963079dd542807d8e77df17637bc59 to your computer and use it in GitHub Desktop.
Save saicharanreddyk/79963079dd542807d8e77df17637bc59 to your computer and use it in GitHub Desktop.
To download a JSON file with search engine settings
(function exportSEs() {
/* Auxiliary function to download a file with the exported data */
function downloadData(filename, data) {
const file = new File([data], { type: 'text/json' });
const elem = document.createElement('a');
elem.href = URL.createObjectURL(file);
elem.download = filename;
elem.click();
}
/* Actual search engine export magic */
settings.SearchEnginesBrowserProxyImpl.prototype.getSearchEnginesList()
.then((searchEngines) => {
downloadData('search_engines.json', JSON.stringify(searchEngines.others));
});
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment