Skip to content

Multiple content-script not working #99

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
imagents opened this issue Mar 21, 2025 · 1 comment
Open

Multiple content-script not working #99

imagents opened this issue Mar 21, 2025 · 1 comment
Labels
🧐 Bug: Needs Confirmation Something isn't working, but needs to be confirmed by a team member.

Comments

@imagents
Copy link

imagents commented Mar 21, 2025

Version

6.0.1

Current Behavior

If you inject multiple content-script into a page with the first one declare onMessage('A) and the second one with no onMessage declaration. When you sendMessage from background. The background will throw an error "No handler registered in 'content-script' to accept messages with A".
However if you switch the first one and second one position in manifest. It works.

Expected Behavior

Both onMessage declared in content-script will work.

Steps To Reproduce

Just create two content-script and inject into the same page

Anything else?

No response

@imagents imagents added the 🧐 Bug: Needs Confirmation Something isn't working, but needs to be confirmed by a team member. label Mar 21, 2025
@SaschaLucius
Copy link

I face the same problem when using WXT with webext-bridge.

If I define two content scripts and try to message between them, I always get:
Error sending xxxxx message: Error: [webext-bridge] No handler registered in 'content-script' to accept messages with id 'xxxxx'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧐 Bug: Needs Confirmation Something isn't working, but needs to be confirmed by a team member.
Projects
None yet
Development

No branches or pull requests

2 participants