How to view/delete local storage in Firefox?

后端 未结 7 1320
萌比男神i
萌比男神i 2020-12-07 08:38

In Google Chrome there is an easy way to see what\'s in local storage as well as modify or delete it after inspecting it.

Is there a way to do the same in Firefox?

7条回答
  •  感情败类
    2020-12-07 09:04

    Try this, it works for me:

    var storage = null;
    setLocalStorage();
    
    function setLocalStorage() {
        storage = (localStorage ? localStorage : (window.content.localStorage ? window.content.localStorage : null));
    
        try {
            storage.setItem('test_key', 'test_value');//verify if posible saving in the current storage
        }
        catch (e) {
            if (e.name == "NS_ERROR_FILE_CORRUPTED") {
                storage = sessionStorage ? sessionStorage : null;//set the new storage if fails
            }
        }
    }
    

提交回复
热议问题