title: Iframe in Chrome error: Failed to read 'localStorage' from 'Window': Access denied for this document
body: <p>I have a web app which uses localStorage. Now we want to embed this web app on other (third-party) sites via iframe. We want to provide an iframe embed similar to youtube so that other websites can embed our web app in an iframe. Functionally it is the same as if it wouldn't be embedded. But it does not work. Chrome prints the error message: </p>
  
  <pre><code>Uncaught SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
  </code></pre>
  
  <p>I just do the following check (in the iframe): </p>
  
  <pre class="lang-js prettyprint-override"><code>if (typeof window.localStorage !== 'undefined') {
      // SETUP SESSION, AUHT, LOCALE, SETTINGS ETC
  } else {
      // PROVIDE FEEDBACK TO THE USER
  }
  </code></pre>
  
  <p>I checked my security settings in Chrome like described in <a href="https://stackoverflow.com/questions/24456891/iframe-in-chrome-error-uncaught-securityerror-failed-to-read-the-sessionstora">another Stackoverflow Thread </a> but it doesn't work. Is there any change to make embedding possible without the need of adjusting (default) security settings of most modern browsers? </p>
  
  <p>To give more information, we use Ember-CLI for our web app and turned on <a href="http://en.wikipedia.org/wiki/Content_Security_Policy" rel="noreferrer">CSP</a> (<a href="http://www.ember-cli.com/#content-security-policy" rel="noreferrer">more info about the Ember-CLI CSP</a>). Could CSP cause our web app to throw security errors?</p>