无法读取localStorage属性

Failed to read the ‘localStorage’ property from ‘Window’ 的解决办法

在使用gitalk作为博客的评论插件时,发布后遇到下面的问题:

1
2
3
4
5
6
7
8
9
10
Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
at new t (https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js:8:10505)
at E (https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js:1:48365)
at O (https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js:1:50375)
at g (https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js:1:46545)
at v (https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js:1:46147)
at Object.T [as render] (https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js:1:50861)
at a (https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js:1:3586)
at e.value (https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js:1:35901)
at https://edit.ncucoder.com/2018/11/17/hexo-up/:1063:14

刚开始还以为是跨域的问题,最后发现是我手动设置了拦截所有来自网站的Cookie:
All cookie is banned

可以在设置中选择高级,再选择内容设置,再点击Cookie,若阻止第三方 Cookie这个选项是打开,需要关闭,然后在禁止的网站中删除需要的网站:
Cookie settings

hsowan wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!