이 번역은 완료되지 않았습니다. 이 문서를 번역해 주세요.

Storage interface의 clear() 메소드는 호출되었을 때 모든 저장된 key들을 없앤다.

Syntax

storage.clear();

Return value

undefined.

Examples

The following function creates three data entries in local storage, then deletes them using clear().

function populateStorage() {
  localStorage.setItem('bgcolor', 'red');
  localStorage.setItem('font', 'Helvetica');
  localStorage.setItem('image', 'miGato.png');

  localStorage.clear();
}

Note: For a real world example, see our Web Storage Demo.

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'Storage.clear' in that specification.
Living Standard  

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic supportChrome Full support 4Edge Full support 12Firefox Full support 3.5IE Full support 8Opera Full support 10.5Safari Full support 4WebView Android Full support YesChrome Android Full support 18Edge Mobile Full support 13Firefox Android Full support 6Opera Android Full support 11Safari iOS Full support 3.2Samsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

See also

Using the Web Storage API

문서 태그 및 공헌자

이 페이지의 공헌자: samee
최종 변경자: samee,