Home > Back-end >  localstorage alternatives for a django iframe app
localstorage alternatives for a django iframe app

Time:01-25

Are there any alternatives for localstorage as we are using this to store a few data. Our issue is that our app is working as an iframe in Shopify, so when testing in incognito window it denies the access of localstorage. This is the error we are getting:

Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.

Can someone please suggest a solution for this issue?

CodePudding user response:

You can use these alternatives:

  1. sessionStorage: This is similar to localStorage, but the data is only stored for the duration of the browser session. Once the user closes the browser or tab, the data is deleted.

  2. IndexedDB: This is a browser-based, NoSQL, transactional database that can be used to store larger amounts of data. It's more complex than localStorage and sessionStorage, but it allows for more advanced data manipulation.

You can find other web databases to store data. And you can use shopify own server storage using API as well.

CodePudding user response:

If you are using chrome as browser, then it is possibly because you may be blocking third party cookies.

So in chrome's settings > Privacy and security > Cookies and other site data > set allow all cookies

When in incognito mode: enter image description here Disable that option showing "Block third party cookies"

  • Related