LocalStorage iFrame issue within Agent Widget

I am creating a small React app to use as an Agent Widget within LiveChat.

I started to receive an error stating:
SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.

In an attempt to track down the issue, the app at this time is simply attempting to render the word “Hi” in the dom, and set a localStorage item via:
localStorage.setItem("test", 1);

I had developed most of the widget and had no issue previously, and am unsure of why this error is now happening.

I have read that using localStorage in iFrames can be troublesome, however LiveChat support informed me that this shouldn’t be an issue. This coincided with me having written and tested the app in the LiveChat agent environment without issue previously.

If I can provide any further information please let me know.


Those errors are usually caused by the customer blocking 3rd pary cookies in your web browser. Since one of the latest releases, Chrome for example blocks cookies by default, when opening the page in Incognito mode.
When you see such error printed in the console, please make sure that 3rd party cookies are enabled and then refresh the page. There’s one additional thing worth remembering though: make sure that your browser does not block pop-up windows, especially when using LiveChat’s AccountsSDK.