스토리지 객체 _
스토리지 객체
Web Storage API의 Storage 개체는 특정 도메인에 대한 세션 저장소 또는 로컬 저장소에 대한 액세스를 제공합니다. 이를 통해 저장된 데이터 항목을 읽고, 추가하고, 수정하고, 삭제할 수 있습니다.
저장소 개체 속성 및 메서드
Property/Method |
Description |
key(n) |
Returns the name of the nth key in the storage |
length |
Returns the number of data items stored in the Storage object |
getItem(keyname) |
Returns the value of the specified key name |
setItem(keyname, value) |
Adds that key to the storage, or update that key's value if it already
exists |
removeItem(keyname) |
Removes that key from the storage |
clear() |
Empty all key out of the storage |
Web Storage API 관련 페이지
Property |
Description |
window.localStorage |
Allows to save key/value pairs in a web browser. Stores the data with no
expiration date |
window.sessionStorage |
Allows to save key/value pairs in a web browser. Stores the data for one
session |