DEV Community

Junaid
Junaid

Posted on

How to Create an Custom Search Engine Extention for Firefox

Requirements

  • Latest Firefox Browser
  • Firefox Addon account - If you plan to publish it on Firefox-Addons.

File System

project_folder/
    |-- manifest.json
    |-- License
    |-- images/
          |-- icon-48.png
          |-- icon-64.png
          |-- icon.png
          
Enter fullscreen mode Exit fullscreen mode

Code

  • An custom Search engine extension.
  {
    "manifest_version": 3,
    "name": "GithubRepoSearch",
    "version": "1.0",
    "description": "Quick Extention to search something across github repos.",
    "chrome_settings_overrides": {
        "search_provider": {
            "name": "Search via Github Repos",
            "search_url": "https://github.com/search?q={searchTerms}&type=repositories",
            "keyword": "@github_repo_search"
        }
    },
    "icons": {
        "48": "images/icon-48.png",
        "64": "images/icon-64.png"
    },
    "browser_specific_settings": {
        "gecko": {
            "id": "email_of_the_developer@example.com"
        }
    }
  }
Enter fullscreen mode Exit fullscreen mode
  • An extension which changes default Search Engine with Custom Search Engine.
  {
    "manifest_version": 3,
    "name": "GithubRepoSearch",
    "version": "1.0",
    "description": "Quick Extention to search something across github repos.",
    "chrome_settings_overrides": {
        "search_provider": {
            "is_default": true,
            "name": "Search via Github Repos",
            "search_url": "https://github.com/search?q={searchTerms}&type=repositories",
            "keyword": "@google"
        }
    },
    "icons": {
        "48": "images/icon-48.png",
        "64": "images/icon-64.png"
    },
    "browser_specific_settings": {
        "gecko": {
            "id": "email_of_the_developer@example.com"
        }
    }
  }
Enter fullscreen mode Exit fullscreen mode
  • I added "is_default":true and changed keyword to @google, which overrides Google with Custom Search Engine.

    • More about chrome_settings_overrides - related.
  {
      "manifest_version": 3,
      "name": "NO GOOGLE AI OVERVIEW",
      "version": "1.4",
      "description": "Open-source, Simple and Ready to use NO GOOGLE-AI OVERVIEW extension.",
      "chrome_settings_overrides": {
          "search_provider": {
              "is_default": true,
              "name": "NO-OVERVIEW",
              "search_url": "https://google.com/search?udm=14&q={searchTerms}",
              "suggest_url": "https://suggestqueries.google.com/complete/search?client=firefox&q={searchTerms}",
              "keyword": "@google"
          }
      },
      "icons": {
          "48": "icons/icon-48.png",
          "64": "icons/icon-64.png"
      },
      "browser_specific_settings": {
          "gecko": {
              "id": "junaid@abujuni.dev"
          }
      }
  }
Enter fullscreen mode Exit fullscreen mode

NOTE : Here, I taken GithubRepoSearch for Example.

What's Going on here?

The chrome_settings_overrides - Overrides browser settings in Firefox.

  • is_default: Sets the custom search engine as the default.
  • name: Name of the custom search engine.
  • search_url: The URL used for search queries.
    • {searchTerms}: This placeholder is replaced with the actual search query by the browser.
  • suggest_url: URL used for search suggestions. Note: The response from this URL must be in JSON format.
    • {searchTerms}: This placeholder is replaced with the actual search query by the browser.
  • keyword: Custom keyword for triggering the search engine or @google to override it with custom search engine.

How to submit your Extension in Firefox-Addons or Add-ons?

  • Create an Zip of project.

  • Create an account in Firefox-Addons or Add-ons

  • Click on Submit New Add-on

  • Fill the form.

  • Click on Edit Product Page and Fill the Information.

  • Important Fields to fill

      Edit Product Page           - Edit your Add-on's Page.
      Manage Authors & License    - Add or Remove Authors and License
      Manage Status & Versions
Enter fullscreen mode Exit fullscreen mode
  • Wait until your Status says Approved , it takes around 2days to 4weeks.

  • Ola! you uploaded your first Firefox extension.


Sources :

Author : Junaid

Top comments (0)