Skip to content
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

Support return value from content script executed by MV2 #1425

Closed
harmonyharmo opened this issue Feb 12, 2025 · 6 comments
Closed

Support return value from content script executed by MV2 #1425

harmonyharmo opened this issue Feb 12, 2025 · 6 comments
Labels

Comments

@harmonyharmo
Copy link

Feature Request

Support return value from content script executed by MV2 chrome.tabs.executeScript

Is your feature request related to a bug?

"N/A"

What are the alternatives?

Message passing, which has more overhead and harder to write.

Additional context

Add any other context or screenshots about the feature request here.

@aklinker1
Copy link
Collaborator

aklinker1 commented Feb 13, 2025

Already supported for both MV2 and MV3: https://wxt.dev/guide/essentials/scripting.html#execute-script-return-values

Image

There is the other issue you created, #1428, but MV2 content scripts do already return values. So I'm gonna mark this specific issue as completed. We can discuss MV2 support for registration: "runtime" on the other issue.

@harmonyharmo
Copy link
Author

Unfortunately when I use the MV2 tabs.executeScript, I don't get the return value in the content script:

Image

@harmonyharmo
Copy link
Author

I get empty {} instead of '123'

@aklinker1
Copy link
Collaborator

You're not returning the value...

- '123'
+ return '123'

@harmonyharmo
Copy link
Author

It's the same, gets {}. you can try it

@aklinker1
Copy link
Collaborator

@harmonyharmo can you share a reproduction so I don't have to create it from scratch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants