top

Using Web Storage

This document covers how to handle data by calling Web Storage.

Overview

For handling data, Samsung TV supports web standard Web Storage.

Please note that you can use Web Storage to handle data with less than 5MB by application. If it is over than 5MB, please refer to Using Filesystem.

Calling Web Storage Method

Web Storage provides a few methods.

  • localStorage.setItem method
    You can save value with key by this method. If key is not exist, new key and value are saved. If key is already exist, value is updated.

    localStorage.setItem('sample', 'This is just sample test.');
    
  • localStorage.getItem method with key
    You can get value of key by this method. If key is not exist, null is returned.

    var value = localStorage.getItem('sample');
    console.log(value);
    
  • localStorage.removeItem method with key
    You can remove value by this method. If key is not exist, this method does nothing.

    localStorage.removeItem('sample');
    

Sample Application