Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Local storage only stores string
- //so if you do this in one browser.....
- var obj = {'name':'rick', age:100};
- localStorage['empId1'] = obj;
- //Then this in the other browner (same URL)...
- var obj = localStorage['empId1']
- //obj is this string... "[object Object]"
- //This is not actual very useful.
- //Instead you need to do this
- //In the first browser do this.
- localStorage['empId1'] = SC.json.encode(obj);
- // which stores this string "{"name":"rick","age":100}"
- //Then retrieve it as follows in the other browser:
- var obj = SC.json.decode(localStorage['empId1']);
- // now obj.name is "rick"
Add Comment
Please, Sign In to add comment