Skip to content

4storia/sidepanel-content-script-communication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Request for more context information in sidePanel

Original cloned from the chrome extensions cookbook, this repo illustrates how to enable 2-way communication with a tab-specific sidepanel.

Doing this, as far as I can tell, requires passing tabId as part of the sidepanel url. In all other cases, the sidepanel is effectively an orphaned frame without a unique tab/frame id to refer to, making it impossible to know what tab it is rendered next to.

It would be awesome if there was a way to get the tab(s) that a sidepanel was currently rendered next to, so it can receive messages specifically from those tabs.

Running this extension

  1. Clone this repository.
  2. Load this directory in Chrome as an unpacked extension.
  3. Pin the extension.
  4. Go to https://www.google.com.
  5. Click on the action icon to open the side panel.
  6. Repeat steps 4 & 5, so you have two side panel instances open.
  7. Inspect the side panel in either tab - you can see that it receives messages from both tabs. Without manually providing the side panel with its tab id up front, there would be know way to know which side panel instance should respond to a message.

💡 You can also open the side panel by pressing Ctrl+B (Windows) or Cmd+B (macOS).

Google.com side panel

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published