VOOZH about

URL: https://www.geeksforgeeks.org/html/html-dom-storage-getitem-method/

⇱ HTML | DOM Storage getItem() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML | DOM Storage getItem() Method

Last Updated : 14 Jul, 2022

The getItem() method is used to retrieve the storage object which is specified by the user. This storage object can be localStorage object or sessionStorage object. Syntax:Parameters: It requires Keyname which specifies name of the key used for getting the value. 

Return Value: A String, representing the value of the specified key. 

Example: Get item from local storage. 

Output: 

Before:

 👁 Image
 

After:

 👁 Image
 

Supported Browsers: The browser supported by DOM getItem() Method are listed below:

  • Google Chrome 4 and above
  • Edge 12 and above
  • Internet Explorer 8 and above
  • Firefox 3.5 and above
  • Opera 10.5 and above
  • Safari 4 and above
Comment