K
K
Konstantin Vasilyev2021-05-13 14:56:26
JavaScript
Konstantin Vasilyev, 2021-05-13 14:56:26

How to save and read browser extension settings in JS?

For example, if the checkbox is checked, then execute one code, if not, then another.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alex, 2021-05-13
@Kozack

https://developer.chrome.com/docs/extensions/refer...

N
Nadim Zakirov, 2021-05-13
@zkrvndm

You need to store data in a database and not just a database, but preferably in a background process database. For example, I myself always use IndexedDB, it is convenient because you can store anything there - any data type.
PS There is a risk of losing data if the user completely clears the history and cache or reinstalls the extension. If you need high reliability, you can store the data on your server at all, or offer the function of exporting and importing data with a special settings file. I can't say anything about chrome.storage, I've never used it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question