Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sni opened this issue Jul 30, 2020 · 6 comments

Comments

@sni
Copy link

sni commented Jul 30, 2020

Expected and Actual Behavior

Getting the error: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
when opening an iframed page using fancytree.
I am not even enabling or using the persitance plugin, its just bundled within the all-deps.js file.

Chrome dev tools clearly show the origin of the error is here:

localStorageStore = window.localStorage

Steps to Reproduce the Problem

  1. use fancytree in an iframe over different domains
  2. make sure the "block third party..." setting is enabled in chrome (https://www.chromium.org/for-testers/bug-reporting-guidelines/uncaught-securityerror-failed-to-read-the-localstorage-property-from-window-access-is-denied-for-this-document) But as far as i can see, this is the default.

Environment

  • Browser type and version: Version 83.0.4103.116 (Developer Build) built on Debian bullseye/sid, running on Debian bullseye/sid (64-bit)
  • jQuery and jQuery UI versions: bundled with fancytree
  • Fancytree version: fancytree-2.36.1/jquery.fancytree-all-deps.min.js
@sni
Copy link
Author

sni commented Jul 31, 2020

same applies to

sessionStorageStore = window.sessionStorage

i simply replace window.localStorage and window.sessionStorage with null as quick workaround for now.

mar10 added a commit that referenced this issue Aug 1, 2020
@mar10
Copy link
Owner

mar10 commented Aug 1, 2020

Hi,
could you try if this fixes it for you:
https://raw.githubusercontent.com/mar10/fancytree/master/src/jquery.fancytree.persist.js
(Should display a warning, but not fail.)

@mar10 mar10 added the waiting label Aug 1, 2020
@sni
Copy link
Author

sni commented Aug 3, 2020

is there a jquery.fancytree-all-deps.min.js with this fix already by any chance? Otherwise i will try build my own.

@mar10
Copy link
Owner

mar10 commented Aug 3, 2020

You can try this build:
jquery.fancytree-all-deps.min.js.zip

@sni
Copy link
Author

sni commented Sep 4, 2020

Hi,
could you try if this fixes it for you:
https://raw.githubusercontent.com/mar10/fancytree/master/src/jquery.fancytree.persist.js
(Should display a warning, but not fail.)

Just tested the new file and can confirm this. It puts a warning in the browsers console but works fine now.

Thanks

@sni sni closed this as completed Sep 4, 2020
@classifaddict
Copy link

This issue is back in 2.38.0:
jquery.fancytree-all-deps.2.38.0.min.js:1 Fancytree assertion failed
jquery.fancytree-all-deps.2.38.0.min.js:1 Could not access window.localStorage
jquery.fancytree-all-deps.2.38.0.min.js:1 Fancytree@1
jquery.3.6.0.min.js:2 jQuery.Deferred exception: 'undefined' is not an object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants