How to access and modify the local storage of a page

I’m trying to write an extension that can modify the local storage (the one in Web Developer Tools > Storage > Local Storage > [page name]) of a website. The website stores places of interest that you’ve clicked on on a map in local storage, meaning that if you visit the same page on another device (even if you’re logged in), it won’t remember the places you’ve seen on the map on the other device. The goal of the extension is to sync the list of places that have been seen across devices by storing the list in the extension’s sync storage, and then writing to the page’s local storage.

From what I’ve read, I should be using a content script to achieve this, but I have no idea how I can get the local storage from the script. I’ve tried logging window.content.localStorage, but nothing was ever printed, not even an error.

What is the best way to go about this?

Try without the “content”, whatever that is :slight_smile:, I’ve never seen that before.

Look at these examples:

Thanks, that fixes it.