Menu

Post image 1
Post image 2
1 / 2
0

Building a Cookie Manager Chrome Extension: What I Learned From the MV3 Transition

DEV Community·SHOTA·24 days ago
#4ZPrv8UX
Reading 0:00
15s threshold

Cookie management extensions are one of the oldest categories in the Chrome Web Store. EditThisCookie has been around since 2011 and still has millions of users. The category is established, the use cases are well-understood, and it's a good study in how to migrate a conceptually simple tool to Manifest V3. I built CookieJar as an EditThisCookie alternative built natively on MV3. Here's what the development revealed. The cookies API in MV3 The Chrome cookies API is straightforward. To get all cookies for the current tab: async function getCookiesForTab ( tabId : number ): Promise < chrome . cookies . Cookie [] > { const [ tab ] = await chrome . tabs . query ({ active : true , currentWindow : true }); if ( ! tab ?. url ) return []; return chrome . cookies . getAll ({ url : tab . url }); } Enter fullscreen mode Exit fullscreen mode The url parameter scopes the query to cookies accessible to that origin (matching domain and secure flag). Pass {} instead to get all cookies the extension can see.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More