mikehostetler / amplify

AmplifyJS
http://amplifyjs.com
GNU General Public License v2.0
1.45k stars 143 forks source link

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

Open crmpicco opened 9 years ago

crmpicco commented 9 years ago

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?

jakerella commented 9 years ago

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.