httpsindexeddbbravebrave-browser

Read HTTP IndexedDB data from HTTPS web app


I created data on my app and stored it in an IndexedDB.

After upgrading to HTTPS, the data disappeared since the address is different. Now I need to access it again.

I tried to remove the certificate on the server but this didn't help. The browser (Brave on iPad) still forces HTTPS, even if I deactivate the HTTPS Brave Shield option.

My main question is how can I retrieve the "unsecured" data, while having access to domain DNS settings, code and browser.


Solution

  • Browser storage is origin-scoped. http://example.com and https://example.com are different origins. They can't access each others' data - they have a different localStorage, a different set of IndexedDB databases, etc.

    Origins can cooperate to share data. In the past, you could have a page from the https origin contain an iframe in the http origin, and they could use postMessage() to communicate to proxy the data - i.e. the parent frame messages the child frame saying "give me your data" and the child frame validates that the request is from the expected origin, pulls the data out of the database, and sends it back to the parent.

    That will still work in Chrome, but browsers are generally moving towards partitioning data in third-party iframes (so the storage seen by a top level B.com window is different than the storage seen in a B.com iframe inside an A.com window). I believe a non-iframe (i.e. via window.open()) would work here, although it would be more disruptive to the user.