HTML 5 + Local Storage or event.dataTransfer

Here is the most basic example to save data inside HTML5 local storage.

localStorage.setItem("acomplexname", "text data to be saved");
localStorage.getItem("acomplexname"); 
localStorage.removeItem("acomplexname");


Local storage is a good alternative for event.dataTranfer because some browsers are restrictive and doesn't allow outside world to fetch data, a bit more detail can be found here Bug
event.dataTransfer.setData('text/plain', "data to be saved");
event.dataTransfer.getData('text/plain');

Comments

Popular posts from this blog

Inserting and Moving elements inside Ruby Array

Interview Question on Ruby on Rails