mirror of
https://github.com/GoogleChrome/chrome-extensions-samples.git
synced 2026-03-26 13:19:49 +07:00
These were being loaded from a CDN from our old hosting infrastructure for developer.chrome.com. This is no longer live, and we shouldn't have been using external images anyway, so move all of the images to the repo. Fixes #1171
1.2 KiB
1.2 KiB
Dictionary Side panel example
This example allows users to right-click on a word and see the definition on the side panel using the Side Panel API.
NOTE: This example only defines the word extensions and popup.
Implementation Notes
When the user selects a word, we need to send it to the side panel, but that
may not be open yet. To handle this we store the word in
chrome.storage.session, which results in the following:
- If the side panel is already open, the
storage.session.onChangedevent will fire in the side panel. - Otherwise, the value will be loaded from storage when the side panel opens.
Running this extension
- Clone this repository.
- Load this directory in Chrome as an unpacked extension.
- Go to https://developer.chrome.com/docs/extensions/
- Right-click on the "Extensions" word.
- Choose the "Define" context menu
You should see the definition on the side panel