amplify icon indicating copy to clipboard operation
amplify copied to clipboard

losing the data in local storage that I set on a HTTP page when I move to a HTTPS page

Open crmpicco opened this issue 10 years ago • 1 comments

I am experiencing an issue where I am losing the data in local storage that I set on a HTTP page when I move to a HTTPS page.

I have upgraded to AmplifyJS 1.1.2 to see if that remedies the issue, but it has no effect.

On the HTTP page I do this:

amplify.store('list_id_to_add', prod_id);
window.location = base_url + '/list/';

On the HTTPS page I got this:

if(amplify.store('list_id_to_add')){        
    // do something...
} else {
    console.log('theres nothing');
}

...but it never finds it. This code hasn't changed in a long time, so i'm not sure why this isn't working. I have tested this on FF and Chrome and the issue is prevalent in both browsers. It doesn't appear to be just this key either, I can't see any values. Is there anything you can advise?

crmpicco avatar Feb 06 '15 17:02 crmpicco

This is correct behavior. Local storage is restricted by the same cross-origin policy as ajax requests, which includes restrictions based on protocol (http vs https), full domain (including subdomains), and port.

jakerella avatar Feb 06 '15 22:02 jakerella