defendtheweb / hackthis.co.uk

HackThis!!
http://www.hackthis.co.uk
Other
46 stars 55 forks source link

Fixing bug #139 - Moving from message dropdown to full view #164

Closed doronlinder closed 9 years ago

doronlinder commented 9 years ago

When clicking on the Full View line in the message composition dropdown I save the message recipients and content to the local storage. When the compose page finishes loading (document ready event), the local storage is checked and if there are values stored there, they are filled in the appropriate fields. Afterwards, the values are removed from the cache.

lwward commented 9 years ago

Nice solution! I wouldn't have thought about using localstorage. Does this have any benefits over submitting the form to the new page and use POST variables?

doronlinder commented 9 years ago

Thanks. I preferred not to send unfinished message to the server and back; not so much for security reasons, I just thought it's a bit cleaner this way. Theoretically it also could have enabled to make the Full View page (inbox/compose) cache-able, although I think it's not cached anyway since there is a dynamic part there. POST had been a better solution if local storage support wasn't so good, but it's supported in all modern browsers (even IE8).