I am creating a location-based web application that will work mainly on mobile browsers. It will be encoded with HTML5, javascript and PHP. I would like the user to be invited to log in as rarely as practical. I would like them to log in (via PHP) and then stay on for x time.
I know how to do this with cookies, but I experimented with HTML5 localStorage. If I use localStorage, I have to do all the validation using javascript and send it to PHP via Ajax. Since I am thinking how to do this, I am wondering if it is worth using localStorage. As far as I understand, it is more secure than cookies because data is not transmitted with every HTTP request and it cannot be accessed cross-domain. But do modern browsers, such as iOS and Android, not allow cross-domain access to cookies?
Am I just complicating myself using localStorage? What are the reasons for choosing localStorage over cookies in this case?
source share