HTML | DOM Storage key() Method Last Updated : 04 Aug, 2022 Comments Improve Suggest changes Like Article Like Report The DOM Storage key() Method is related to the Storage object and is used to return the name of the key with the specified index. Storage object can be either a localStorage or sessionStorage Object. Syntax: Local storage:localStorage.key(index)Session storage:sessionStorage.key(index) Parameters: It accepts a parameter i.e. index to get the name of the key with that particular given index. Return Values: It returns the name of the key in the form of the string. Below is the HTML code to show the working of HTML DOM Storage key() Object:Example: HTML <!DOCTYPE html> <html> <head> <title> HTML DOM Storage key() Method </title> <!-- Script to get the name of the key --> <script> function myGeeks() { var key = localStorage.key(0); document.getElementById( "geeks").innerHTML = key; } </script> </head> <body> <h1>GeeksForGeeks</h1> <h2>DOM Storage key() Method</h2> <br> <button onclick="myGeeks()"> Submit </button> <p id="geeks"></p> </body> </html> Output: Before Click: After Click: Supported Browsers: The browser supported by DOM Storage key() Method are listed below: Google Chrome 4Edge 12 Internet Explorer 8Firefox 3.5Opera 10.5Safari 4 Create Quiz Comment C Code_Mech Follow 0 Improve C Code_Mech Follow 0 Improve Article Tags : Web Technologies HTML HTML-DOM Explore HTML BasicsHTML Introduction4 min readHTML Editors4 min readHTML Basics7 min readStructure & ElementsHTML Elements4 min readHTML Attributes7 min readHTML Headings3 min readHTML Paragraphs3 min readHTML Text Formatting4 min readHTML Block and Inline Elements3 min readHTML Charsets4 min readListsHTML Lists3 min readHTML Ordered Lists5 min readHTML Unordered Lists4 min readHTML Description Lists3 min readVisuals & MediaHTML Colors11 min readHTML Links Hyperlinks2 min readHTML Images7 min readHTML Favicon4 min readHTML Video4 min readLayouts & DesignsHTML Tables10 min readHTML Iframes4 min readHTML Layout4 min readHTML File Paths3 min readProjects & Advanced TopicsHTML Forms5 min readHTML5 Semantics5 min readHTML URL Encoding4 min readHTML Responsive Web Design11 min readTop 10 Projects For Beginners To Practice HTML and CSS Skills8 min readTutorial ReferencesHTML Tags - A to Z List15+ min readHTML Attributes Complete Reference8 min readHTML Global Attributes5 min readHTML5 Complete Reference8 min readHTML5 MathML Complete Reference3 min readHTML DOM Complete Reference15+ min readHTML DOM Audio/Video Complete Reference2 min readSVG Element Complete Reference5 min readSVG Attribute Complete Reference8 min readSVG Property Complete Reference7 min readHTML Canvas Complete Reference4 min read Like