If http://example.com/ creates an IndexedDB database, is it possible for a Chrome extension (used on domains other than example.com
) to open and query this database?
Asked
Active
Viewed 1.4k times
14

Alf Eaton
- 5,226
- 4
- 45
- 50
-
this discussion says that we can use indexdb in chrome extension https://stackoverflow.com/questions/38905362/update-object-stored-in-chrome-extensions-local-storage – Rahul Pandey Feb 25 '19 at 07:21
2 Answers
9
No, you can not do it. The data storage is sandboxed http://www.html5rocks.com/en/tutorials/offline/storage/

Sudarshan
- 18,140
- 7
- 53
- 61
-
2Being sandboxed wouldn't necessarily exclude allowing access, as Chrome extensions can make cross-domain HTTP requests when permission has been granted. In this case, though, there just doesn't seem to be a way to even ask for access to an IndexedDB from a specific domain. – Alf Eaton Nov 19 '12 at 17:25
-
1Alf, add a bug at crbug.com describing your use case. Things like this have been discussed. – dgrogan Nov 20 '12 at 02:42
-
14Important point: a _content script_ can access it as long as a page at `example.com` is open. – Xan Jun 19 '15 at 15:01
-
1I'm also want to know the answer to this question and I'm a little be confused as I came across this: https://developers.google.com/web/fundamentals/instant-and-offline/web-storage/indexeddb-best-practices. Where it says: "Unlike server-side databases where you can restrict unauthorized access, client-side databases are accessible to browser extensions and developer tools, and they can be cleared by the user." – Kalitine Nov 05 '18 at 16:52
5
Yes, IndexedDB can be accessed through chrome extension with the help of content scripts. Content Scripts can access the indexedDB storage of the domain you have specified in manifest.json file.
For more info check here: https://stackoverflow.com/a/60002682/9131807

neelesh bisht
- 640
- 8
- 13
-
1But I believe data isn't shared as each indexdb store is scoped via origin? If your requiring sharing of data i believe only storing the indexdb data in background script is the way to go. – The.Wolfgang.Grimmer Apr 20 '22 at 05:56
-
1@The.Wolfgang.Grimmer with MV3 it's not a clear decision anymore, since the background script is not an option – Benjámin Gerván Dec 04 '22 at 10:20