简体   繁体   中英

Cross Origin Iframes Parititioning IndexedDB

I have a cross origin iframe that's using indexeddb for local storage. What I want is to have my indexeddb to have the origin set to be origin of the iframe. When I visit the iframe's domain, I want to be able to access the data stored in the indexeddb for that domain.

This works fine in Chrome, however in both Firefox and Safari, I've found a problem. The iframe code is getting two different indexeddbs based on whether it's loaded in an iframe or not. I figured out what Firefox is doing, and I suspect Safari is doing something similar. Firefox is actually partitioning the indexeddb based on the union of the iframe's domain and the embedding parent's domain. (ie Firefox is not segmenting by the iframe's origin, but rather a combination of iframe's and the parent's origins.)

I've been poking around with various sandbox parameters on the iframe, but I haven't figured out a way around this, and there's not a lot of information about this. Is there anyway to force Firefox and Safari to just use the iframe's origin here?

This is due to state partitioning .

You can request unpartitioned state access by using the Document.requestStorageAccess() api

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM