Search code examples
javascriptioshtmlsession-storage

What are the alternatives to html5 session storage?(not local storage)


I want 2 javascript methods to access certain data without passing this data to any of the methods as arguments. Basically I want one method to set the data and other to consume that data using the objects already available in the browser and I want the solution to work with Safari, Firefox, Chrome and IE8+ also iOS and android browsers. I believe session storage does not work on iOS. Is it correct? What are the drawbacks of session storage. I tried to append the data to the event object but it does not work in firefox and IE.


Solution

  • I opted for data attributes instead of above mentioned approaches and they are working fine for me. IE9 and IE8 are presenting some issues which I need to tackle. In IE9 & IE8 the data attributes work sometimes and sometimes not. After I use the console to query data-attributes of the element, they start working.