Comments (5)
@eboraks Have you tried removing the default side panel declaration in the manifest?
"side_panel": {
"default_path": "sidepanel/sidepanel.html"
},
from chrome-extensions-samples.
For other users who might land here, if you have code that looks similar to this:
await chrome.sidePanel.setOptions({
tabId,
path: 'panel.html',
enabled: true,
});
await chrome.sidePanel.open({
tabId,
});
And are receiving this error:
Uncaught (in promise) Error: No active side panel for tabId
Make sure you're calling setOptions
before open
. After making that change, you might start experiencing this error:
Error: `sidePanel.open()` may only be called in response to a user gesture
To fix, remove await
from the setOptions
call. Final working code (for me anyway):
chrome.sidePanel.setOptions({
tabId,
path: 'panel.html',
enabled: true,
});
await chrome.sidePanel.open({
tabId,
});
from chrome-extensions-samples.
This works, thank you @AmySteam!
from chrome-extensions-samples.
I added the following code to see the relationship between tabId and sidePanel
chrome.tabs.onActivated.addListener(async ({ tabId }) => { const { path } = await chrome.sidePanel.getOptions({ tabId }) console.log('tabId: ' + tabId + ' path: ' + path) })
As I moved between tabs that console printed the following.
background.js:31 tabId: 1101905827 path: sidepanel/sidepanel.html
background.js:31 tabId: 1101905829 path: sidepanel/sidepanel.html
background.js:31 tabId: 1101905856 path: sidepanel/sidepanel.html
from chrome-extensions-samples.
hey there, were you able to resolve this? I'm having the same issue and it looks like the documentation says that this behavior is somehow expected.
The tab in which to open the side panel. If the corresponding tab has a tab-specific side panel, the panel will only be open for that tab. If there is not a tab-specific panel, the global panel will be open in the specified tab and any other tabs without a currently-open tab- specific panel. This will override any currently-active side panel (global or tab-specific) in the corresponding tab. At least one of this and windowId must be provided.
from chrome-extensions-samples.
Related Issues (20)
- <!-- Thank you for submitting a Pull Request. Please:
- Kit-khat
- Can't call chrome.desktopCapture.chooseDesktopMedia from serviceWorker without target tab. HOT 1
- .github/CODE_OF_CONDUCT.md
- Chrome 121.0.6167.86 version have a bug some website line Some table lines are not aligned, chrome 120.x not have this BUG same code HOT 4
- How to open devTools after open a new tab? HOT 1
- continuous recording sample - allow user to select media stream tab or window ? HOT 1
- Manifest V3 declarativeNetRequest redirect sample is completely broken on latest chrome 121 HOT 11
- The Quick Start tutorial "quick-api-reference" sample doesn't work HOT 15
- Samples for chrome.management HOT 2
- Network preview tab override HOT 2
- How i can use extensions to hide maximize、minimize HOT 1
- Sample for chrome.types HOT 1
- Sample for chrome.desktopCapture
- Sample for chrome.offscreen HOT 1
- A CI to check for grammer mistake in the `.md` files HOT 8
- Adding a pull request template to the repository as like issue template HOT 2
- CEO
- Sample for chrome.commands API HOT 5
- Proposal: Enforce Node Version Rule and Prevent Modifications to package-lock.json
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chrome-extensions-samples.