In Google Chrome, going under Settings > Advanced > Privacy and security > Content Settigns > Block third-party cookies, and enabling the Block third-party cookies option will break the initialize function of the ldclient-js.
Our application is running in an iFrame, hosted on a different domain, so localStorage is considered as a third-party cookie in this scenario.
Wrapping any access to the localStorage object (even checking it's value) in a try catch solves this problem. Currently I have to wrap the whole LaunchDarkly part of the codebase.
Eg.
// throws exception
if (localStorage) localStoorage.getItem('foo)'
// throws exception
localStorage.getItem('foo')
// doesn't throw exception
try {
localStoorage.getItem('foo)'
} catch (e) {
// cookies disabled, use default value
}
// throws exception
const client: LDClient = LaunchDarkly.initialize(key, user, options)
// doesn't throw exception
try {
const client: LDClient = LaunchDarkly.initialize(envApiKey, user, options)
} catch (e) {
// cookies disabled, use default value
}