HTML DOM Location hash Property Last Updated : 16 Jun, 2023 Comments Improve Suggest changes Like Article Like Report The Location Hash property in HTML is used to return the anchor part of a URL. It can also be used to set the anchor part of the URL. It returns the string which represents the anchor part of a URL including the hash '#' sign. Syntax: It returns the hash property.location.hashIt is used to set the hash property. location.hash = anchorname Property Value: anchorname: It contains a string value that specifies the anchor part of a URL'S. Return Value: It returns a string value that represents the anchor part of a URL. Example: Below program illustrates the Location hash property in HTML: HTML <!DOCTYPE html> <html> <head> <title>DOM Location hash property</title> <style> h1 { color: green; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>DOM Location hash Property</h2> <p> For setting the anchor part to 'newlocationhash', double click the "Set Anchor" button: </p> <button ondblclick="mylocation()"> Set Anchor </button> <p id="hash"></p> <script> function mylocation() { location.hash = "newlocationhash"; let h = "The anchor part is now: " + location.hash; document.getElementById("hash").innerHTML = h; } </script> </body> </html> Output: HTML DOM Location hash Property Supported Browsers: The browsers supported by the Location hash property are listed below: Google Chrome 1Edge 12Internet Explorer 3Firefox 1Opera 12.1Safari 1 Comment More infoAdvertise with us S Shubrodeep Banerjee Follow Improve Article Tags : Web Technologies HTML HTML-DOM Similar Reads HTML DOM console group() Method The console.group() method in HTML is used to create a group of messages in the console. It indicates the start of a message group and all the messages written after calling the console.group() method will write inside the message group. The label is sent as an optional parameter to the console.grou 2 min read HTML DOM console.assert( ) Method The console.assert() method in HTML is used to write a message for the user on the console only if the expression evaluates to false. The expression and the message are sent as parameters to the console.assert() method. Syntax:console.assert( expression, message )Parameters: This method accepts two 2 min read HTML DOM console.info() Method The console.info() method in HTML is used for writing a message in the console. It indicates an important message about any element or object. The message is sent as a parameter to the console.info() method.Syntax:  console.info( message )Parameters: This method accepts a single parameter message wh 2 min read HTML DOM URL Property The DOM URL property in HTML is used to return a string that contains the complete URL of the current document. The string also includes the HTTP protocol such as ( http://).Syntax:document.URLReturn Value: It returns a string value that represents the full URL of the document. Example: In this exam 2 min read HTML DOM head Property The head property in HTML is used to return the first occurrence of the head if multiple heads in the document. It returns the reference of the head object, which represents the <head> elementSyntax: document.headReturn value: It returns the <head> element of the head object.Example: The 2 min read HTML DOM embeds Collection The DOM embeds collection property in HTML is used to return the collection of all embedded elements. The elements in the collection are sorted that appear in the source code. This property is used for read-only. Syntax: document.embedsProperty: This property contains a value length that returns the 3 min read HTML DOM console warn() Method The console.warn() method is used to write a warning message in the console. So open the console to display the output (warning message). Syntax:console.warn( message )Parameters: This method accepts single parameter message which is mandatory. This parameter is used to hold the warning message. Exa 2 min read HTML DOM console trace() Method This console.trace() method is used to display the trace which represents how the code ended up at a certain point. Syntax:console.trace( label )Parameters: This method accepts a single parameter label. Example: In this example, we will use a console.trace() methodHTML<!DOCTYPE html> <html 2 min read HTML DOM title Property The DOM title property is used to return the title of the HTML document and also used to sets the value of the title in the document. This property is used to specify the information about the title.Syntax: It is used to return the title property document.titleIt is used to set the title property do 2 min read HTML DOM createComment() Method The createComment() method is used to create a comment node with some specified text. This property is used to set a text value as a parameter that is of string type. Syntax:document.createComment( text )Parameters: This method accepts single parameter text which is optional. This parameter is used 2 min read Like