HTML DOM Location host Property Last Updated : 03 Aug, 2023 Comments Improve Suggest changes Like Article Like Report The Location Host property in HTML is used to sets or return the hostname and port of a URL. The Location Hash property doesn't return the port number if it is not specified in the URL. Syntax: It returns the host property. location.hostIt is used to set the host property. location.host = hostname:portProperty Value: hostname:port: It contains a string value that defines the hostname and portnumber of a URL. Return Value: A String, representing the domain name and port number, or the IP address of a URL Example: The below program illustrates the Location host Property in HTML: HTML <!DOCTYPE html> <html> <head> <title>DOM Location host Property</title> <style> h1 { color: green; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>DOM Location host Property</h2> <p> For returning the hostname and port of the current URL, double-click the "Return Hostname" button: </p> <button ondblclick="myhost()"> Return Hostname </button> <p id="host"></p> <script> function myhost() { let h = location.host; document.getElementById("host").innerHTML = h; } </script> </body> </html> Output: HTML DOM Location host PropertySupported Browsers: The browser supported by Location host Property are listed below: Google Chrome 1Edge 12Firefox 1Opera 12.1Safari 1 Comment More infoAdvertise with us Next Article HTML DOM console time() Method S Shubrodeep Banerjee Follow Improve Article Tags : Web Technologies HTML HTML-DOM Similar Reads 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 HTML DOM console time() Method The console.time() method in HTML is used to start a timer in the console view. The console.time() method can be used for calculating the time of programs for various testing purposes. The label is sent as a parameter to the console.time() method. Syntax:console.time( label )Parameters: This method 2 min read HTML DOM History forward() Method The History forward() method in HTML is used to load the next URL in the history list. It has the same practical application as the forward button in web browsers. This method will not work if the next page will not exist in the history list. Syntax: history.forwardExample: Below program illustrates 1 min read HTML DOM console log() Method The console.log() method in HTML is used for writing a message in the console. It indicates an important message during the testing of any program. The message is sent as a parameter to the console.log() method. Syntaxconsole.log( message )ParametersParameterDescriptionmessageIt is mandatory and use 2 min read HTML DOM Location hash Property 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 h 2 min read HTML DOM History length Property The History length property in HTML is used to return the count of URLs in the history list of the current browser window. The minimum value returned by this property is 1 because the current page is loaded at the moment whereas the maximum count that can be displayed is 50. Web browsers such as Int 1 min read HTML DOM History back() Method The History back() method in HTML is used to load the previous URL in the history list. It has the same practical application as the back button in our web browsers. This method will not work if the previous page does not exist. This method does not contain any parameter.Syntax: history.back Below p 1 min read Like