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

Hierarchy Request & Permission Denied Error on storageOwner.appendChild(storage) in IE #118

Closed
szafar-techtronix opened this issue Feb 12, 2015 · 6 comments

Comments

@szafar-techtronix
Copy link

In the following method in store.js, Internet Explorer on some machines show the Permission Denied and Hierarchy Request Error on the line storageOwner.appendChild(storage)
It works just fine on some machines but on some machines it is not allowing the page to load. There is an ajax call on the page and it ends up giving the above error in console and sometimes with an alert saying 'There was an error to load this page. Please check idle timer.' It seems that the issue is related to localStorage being disabled in some browsers on some machines. It works absolutely fine in other browsers like Mozilla, Chrome etc. This issue happens on some IE version 10/11

hierarchyrequesterror
permissiondeniederror

    function withIEStorage(storeFunction) {
        return function() {
            var args = Array.prototype.slice.call(arguments, 0)
            args.unshift(storage)
            // See http://msdn.microsoft.com/en-us/library/ms531081(v=VS.85).aspx
            // and http://msdn.microsoft.com/en-us/library/ms531424(v=VS.85).aspx
            storageOwner.appendChild(storage)
            storage.addBehavior('#default#userData')
            storage.load(localStorageName)
            var result = storeFunction.apply(store, args)
            storageOwner.removeChild(storage)
            return result
        }
    }

Can anyone help?

@marcuswestin
Copy link
Owner

Hey,

Sorry you're having trouble, I imagine it's frustrating.

Can you provide a repro? It's very hard to help you without additional information.

Did you search this repo's issues? Check e.g #84 and #82, there may be others.

@axar
Copy link

axar commented Apr 6, 2015

This continues to happen.

I wanted to test to see if the site worked fine if "Enable DOM Storage" is checked off from IE options. I can re-create this on all machine I have tried to use with DOM storage disabled. store.enable says true, while it fails to run with above error.

image

image

TEMP SOLUTION to prevent code from crashing.
if(!store.enabled || localStorage == null) {
//no LS
}

@seryh
Copy link

seryh commented Oct 11, 2016

my fix:

    function withIEStorage(storeFunction) {
      return function() {
        try {
          var args = Array.prototype.slice.call(arguments, 0);
          args.unshift(storage);
          // See http://msdn.microsoft.com/en-us/library/ms531081(v=VS.85).aspx
          // and http://msdn.microsoft.com/en-us/library/ms531424(v=VS.85).aspx
          storageOwner.appendChild(storage);
          storage.addBehavior('#default#userData');
          storage.load(localStorageName);
          var result = storeFunction.apply(store, args);
          storageOwner.removeChild(storage);
          return result;
        } catch(e) {
          return function(){return null;};
        }
      };

@writer0713
Copy link

writer0713 commented Oct 31, 2016

@seryh
Your code cannot resolve this problem.
I got the same problem in IE10.
And it was because of IE10 private setting. (I don't know exactly which setting makes this problem.)
However, after clicking 'Restore advanced settings' button, it is solved.

@marcuswestin
Copy link
Owner

Looks like this was resolved. Feel free to reopen with more info.

@marcuswestin
Copy link
Owner

Store.js v2.0 has been released with pluggable fallback backing storages which ensure that store.js always works in any environment.

If you update to the v2 backcompat version you will automatically get this functionality plus a bunch more :)

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

No branches or pull requests

5 participants