I have been tasked with copying a particular value from a chosen key in the browsers local storage into the cookie for the website; the browser being used is Safari.
This particular value contains the users logon details, as the browser on the device will only ever be used by one person the designer is happy with keeping this sort of sensitive information in the browsers local storage.
My question is how would I go about populating the cookie with the correct data using Javascript?, possibly using JSON to store the data initially.
Thanks for your time.
You can also use a jQuery cookie plugin
Assuming the key in localStorage is 'username':
This cookie will expire in 7 days. Change the '7' (there's only one there) to however many days you want. To store other keys just change the two occurrences of 'username' in the above code to whatever the name of the variable is ('password', for example).