You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is quite an obscure problem - we discovered it after integrating a form from our Blitz app in an iframe within our webflow landing page.
If third-party cookies are disabled then a Blitz app will crash when run in an iFrame in chrome.
This is Chrome's default setting when running in incognito.
As a side effect of third-party cookies being disabled, localStorage is also disabled. Because Blitz relies on localStorage within PublicDataStore:
updateState(value?: PublicData | EmptyPublicData, opts?: {suppressEvent: boolean}) {
// We use localStorage as a message bus between tabs.
// Setting the current time in ms will cause other tabs to receive the `storage` event
if (!opts?.suppressEvent) {
// Prevent infinite loop
localStorage.setItem(this.eventKey, Date.now().toString())
}
this.observable.next(value ?? this.getData())
}
This problem can be fixed by wrapping the localStorage.setItem call in a try/catch block
Paste all your error logs here:
DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
Paste all relevant code snippets here:
PASTE_HERE (leave the ``` marks)
What are detailed steps to reproduce this?
Try to load a blitz app in an iframe in Chrome when third-party cookies are disabled.
Observe the following error: DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
What is the problem?
This is quite an obscure problem - we discovered it after integrating a form from our Blitz app in an iframe within our webflow landing page.
If third-party cookies are disabled then a Blitz app will crash when run in an iFrame in chrome.
This is Chrome's default setting when running in incognito.
As a side effect of third-party cookies being disabled, localStorage is also disabled. Because Blitz relies on localStorage within
PublicDataStore
:This problem can be fixed by wrapping the
localStorage.setItem
call in atry/catch
blockPaste all your error logs here:
Paste all relevant code snippets here:
What are detailed steps to reproduce this?
DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
Run
blitz -v
and paste the output here:The text was updated successfully, but these errors were encountered: