Pass data from Content.ts to Options Page via Storage API
Unable to pass user data from
content.ts
to the options page using Storage API. Data is being set but returns undefined when accessed.
Current Behavior
- Data is collected from website in content.ts
- Attempting to store data using Chrome Storage API
- When accessing the data in options page, it returns undefined
Expected Behavior
Data collected in content.ts
should be:
1. Successfully stored using Storage API
2. Accessible in the options page
Technical Details
- Using Storage API
- Written in TypeScript
- Data is collected from website DOM
More about it
As you can see on the images, I'm setting the data on the initialize.ts
and using it in a Options Page called "login"13 Replies
@lab could you help me with that? I saw that you rock with plasmo framework lol
someone?
Wait what parsing a another website storage to a new one ?
You can't do that I think
I have a content.ts that extracts the phone number from WhatsApp web, and I want to store that to use on options page
Bro wtf is options page is in new tab ryt?
Thats options oage
Ohh nerd my bad
Yeah
I think I’m going to use the plasmo messaging api to send a message from the content.ts to the options page and then store it using the storage api
Ohh ok cool
that does not work as well i think
@lab can you help here?
use messaging api
send the data into background service worker
store in the Storage
and then you can use it inside the options page with
useStorage
https://docs.plasmo.com/framework/messaging
https://docs.plasmo.com/framework/background-service-worker
https://docs.plasmo.com/framework/storage
Plasmo Docs
Messaging API – Plasmo
The Plasmo messaging API is a powerful tool for sending real-time messages between different parts of your extension.
Plasmo Docs
Background Service Worker – Plasmo
Documentation on how to use background service workers with Plasmo.
Plasmo Docs
Storage API – Plasmo
A library that makes it easy to store data in your browser extension's storage.
@gmasid has reached level 2. GG!