在Internet Explorer中,如果用戶在Internet域的安全選項卡上選中了保護模式,則window.localStorage.setItem()
會以靜默方式失敗。是否有特定於Microsoft的測試功能是否已啓用?僅僅存在的測試返回true。如何測試用戶安全設置是否會導致window.localStorage不能在Internet Explorer中工作?
1
A
回答
-1
if(window.localStorage&&window.sessionStorage){
// do storage stuff;
}
else {
alert('your userAgent does not support DOM Storage or it is disabled by your browser settings or Group Policy');
}
在MSIE(8及更高版本)瀏覽器的DOM存儲是用戶和GPO從Internet選項>高級選項卡配置的「啓用DOM存儲」 ......
的localStorage和sessionStorage的是「未定義」在html文件使用file:協議。使用本地主機或Web服務器進行開發和測試。
嗨, 我的壞....
if ('undefined'!==typeof(win.localStorage)) {
OT:我看到我的論壇小狗還在操我的腿......
+1
即使它們被禁用,測試也會返回true。那就是問題所在。 – Tim 2014-12-03 00:06:16
相關問題
- 1. 是否有可能在javascript中檢測Internet Explorer增強安全配置?
- 2. 錨不會在Internet Explorer中工作11
- 3. 從最終用戶獲取Internet Explorer安全設置
- 4. 表單不能在Internet Explorer中工作
- 5. .html()不能在Internet Explorer中工作
- 6. 腳本不能在Internet Explorer中工作
- 7. JavaScript不能在Internet Explorer中工作
- 8. jQuery不能在Internet Explorer中工作
- 9. Jquery .get()不能在Internet Explorer中工作
- 10. 面具不能在Internet Explorer中工作
- 11. MouseEvent不能在Internet Explorer中工作
- 12. $ state.go不能在Internet Explorer中工作
- 13. Request.Params Request.Form不能在Internet Explorer中工作
- 14. animate()不能在Internet Explorer中工作
- 15. JavaScript不能在Internet Explorer中工作
- 16. JS不能在Internet Explorer中工作
- 17. History.js不能在Internet Explorer中工作
- 18. 如何關閉Azure中的Internet Explorer增強安全設置
- 19. 如何在Internet Explorer中測試Rails Juggernaut?
- 20. Internet Explorer測試
- 21. 如何判斷是什麼導致Internet Explorer發出安全警告
- 22. Jquery Selector不能在Internet Explorer上工作
- 23. 如何檢測Internet Explorer視頻是否退出全屏模式?
- 24. 如何測試BOOL是否存在於NSUserDefaults用戶設置中?
- 25. 在Internet Explorer中測試Sapui5應用程序不起作用
- 26. Actionscript onMouseOut監聽器不能完全在Internet Explorer 8下工作
- 27. 淡入形式在Internet Explorer中不工作(測試8),即正常工作(11)
- 28. beforeSend在jQuery中使用ajax時不能在Internet Explorer中工作
- 29. 基金會不能在Internet Explorer上工作
- 30. PHP會話不能在Internet Explorer中工作,Cookie工作得很好雖然
它是如何默默地失敗?如果你立即檢查該物品,它不在嗎?或者它是否被設置(如果你檢查它,它在那裏),但是一旦窗口關閉,該項目就會丟失? – Louis 2014-12-02 17:34:39
我一直在檢查它,好像它應該持續下去,而不是隻有會話一樣長。關閉瀏覽器並在15秒後重新打開頁面,並且沒有值。但在其他瀏覽器(Opera,Chrome,FF)中,值*正在被正確寫入存儲,並且它們仍然存在。 – Tim 2014-12-02 18:12:35
所以我認爲'setItem'設置一個測試值,然後立即執行'getItem'來得到它,並且這不會告訴你任何事情,因爲問題是持久性。 – Louis 2014-12-02 18:15:57