[javascript] 報錯SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.


當使用chrome 無痕模式時, 默認阻止第三方cookie 

如果使用了localStorge或者cookie , 就會在js里報錯

報錯SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.

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

 

這個問題只能在代碼層面做兼容處理 ,先不讓報錯

            if(navigator.cookieEnabled&&typeof window.localStorage !== 'undefined') {
      
            }

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM