Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
220 views
in Technique[技术] by (71.8m points)

javascript - localForage setItem/getItem unreliable in Firefox / FireStorage Plus

I am loading a local instance of localForage and using it with Promise chains to save basic data. A simple example:

localforage.getItem("sellerExtension").then(function(sellerExtension) {
if ((!sellerExtension)  || (sellerExtension.length < 3)) {
    var sellerExtension = $('input#sellerExtension').val();
    if ((sellerExtension)  && (sellerExtension.length > 3)) {
        localforage.setItem('sellerExtension', sellerExtension).then( function() {

        });
    }
} 
});

The problem comes when I go into the FF Dev-Tools to check FireStorage Plus! and see nothing related to the saved/set data. BUT I do in Chrome just fine. There should be several saved items.

I'd been replacing localStorage (just for Firefox ugh) and am somewhat perplexed why thier own wrapper isn't showing in this FF specific extension for accessing the local DB instances. It shows key, getItem, clear and all, however.

Any ideas why this is happening? I fully expected to see something, and am looking in the right spot, I believe. (Screenshot below) It doesn't seem to be loading the data from a .getItem request, either.

I am using some AJAX to access other files in a sub-directory which handles localForage, but am on the same domain/port. Could I somehow be working in another scope? How would I know?

Thanx MUCH for any assistance!

enter image description here

And in Chrome I see it all...

enter image description here

BUT not in FF in any of the Scopes listed...

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Could the problem be that it's localStorage and not localForage as you have in your code?

Did you notice that in your screen shot, the Firebug tab says localStorage on it?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...