title: Should I use localStorage instead of cookies for web app targeted at mobile browsers?
body: <p>I'm building a location-based web app that will run primarily on mobile browsers. It will be coded with HTML5, javascript, and PHP. I'd like the user to have to be prompted to login as infrequently as practical. I'd like them to login (via PHP) and then stayed logged in for x amount of time.</p>
  
  <p>I know how to do this with cookies, but I've been experimenting with HTML5 localStorage. If I use localStorage, I have to do all the validation with javascript and send it to PHP via Ajax. As I'm thinking through how to get this done, I wonder if using localStorage is really worth it. From what I understand, it's more secure than cookies because the data is not transmitted with every HTTP request, and it can't be accessed cross-domain. But don't modern browsers, like iOS and Android, prevent cross-domain access to cookies?</p>
  
  <p>Am I just making it harder on myself by using localStorage? What are the reasons to choose localStorage over cookies in a case like this? </p>