Menu

#1696 Update global context search sample to use country restrictions

closed
nobody
None
2026-06-02
2026-06-01
Anonymous
No

Originally created by: KirtiRamchandani

Problem

The global_context_search sample still demonstrates country-specific Google searches by switching between Google country-code domains. That no longer produces a meaningful visible difference in Google Search results, which makes the sample feel outdated.

Root cause

The sample stores country choices as Google TLDs and builds search URLs like https://google.ca/search. Google Search now generally localizes results independently from the selected domain.

Solution

Keep the same chrome.contextMenus flow, but model the popup/menu choices as country regions and open https://www.google.com/search with the cr=countryXX search parameter. The README and manifest description now describe country-restricted Google results instead of different country domains.

Tests run

  • npx eslint api-samples/contextMenus/global_context_search/background.js api-samples/contextMenus/global_context_search/locales.js api-samples/contextMenus/global_context_search/popup.js
  • npm exec --yes --package prettier@3.3.3 -- prettier --check api-samples/contextMenus/global_context_search/README.md api-samples/contextMenus/global_context_search/manifest.json api-samples/contextMenus/global_context_search/background.js api-samples/contextMenus/global_context_search/locales.js api-samples/contextMenus/global_context_search/popup.js
  • git diff --check

Fixes [#1653]

Related

Tickets: #1653

Discussion

  • Anonymous

    Anonymous - 2026-06-01

    Originally posted by: KirtiRamchandani

    Closing this as a duplicate of [#1689], which already covers [#1653] with the same country-restricted search update and broader sample copy refresh.

     

    Related

    Tickets: #1653
    Tickets: #1689

  • Anonymous

    Anonymous - 2026-06-01

    Ticket changed by: KirtiRamchandani

    • status: open --> closed
     

Log in to post a comment.