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"
No description
No description
13 Replies
Pedro Otávio
Pedro OtávioOP•2w ago
@lab could you help me with that? I saw that you rock with plasmo framework lol someone?
Zaid
Zaid•2w ago
Wait what parsing a another website storage to a new one ? You can't do that I think
Pedro Otávio
Pedro OtávioOP•2w ago
I have a content.ts that extracts the phone number from WhatsApp web, and I want to store that to use on options page
Zaid
Zaid•2w ago
Bro wtf is options page is in new tab ryt?
Pedro Otávio
Pedro OtávioOP•2w ago
No description
Pedro Otávio
Pedro OtávioOP•2w ago
Thats options oage
Zaid
Zaid•2w ago
Ohh nerd my bad
Pedro Otávio
Pedro OtávioOP•2w ago
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
Zaid
Zaid•2w ago
Ohh ok cool
Pedro Otávio
Pedro OtávioOP•2w ago
that does not work as well i think @lab can you help here?
gmasid
gmasid•2w ago
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
gmasid
gmasid•2w ago
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.
Arcane
Arcane•2w ago
@gmasid has reached level 2. GG!

Did you find this page helpful?