HTML DOM Location protocol Property Last Updated : 03 Aug, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report The Location protocol property in HTML is used to return the protocol or set the protocol of the current URL. It returns a string that contains the protocol of the current URL, including the colon (:). Syntax: It returns the protocol property. location.protocolIt is used to set the protocol property. location.protocol = protocolProperty Value: This method accepts single value protocol of string type. It is used to set the protocol of the URL. The possible value of protocols is- file:, ftp:, http:, https: etc. Return Value: It returns a string value that represents the protocol of the current URL, including the colon (:) Example: The below program illustrates the Location protocol property in HTML html <!DOCTYPE html> <html> <head> <title>DOM Location protocol Property</title> <style> h1 { color: green; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>DOM Location protocol Property</h2> <p> For returning the protocol of the current URL, double click the "Return Protocol" button: </p> <button ondblclick="myprotocol()"> Return Protocol </button> <p id="pro"></p> <script> function myprotocol() { let p = location.protocol; document.getElementById("pro").innerHTML = p; } </script> </body> </html> Output: Supported Browsers: The browser supported by the Location protocol property are listed below: Google Chrome 1Edge 12Firefox 1Opera 12.1Safari 1 Comment More infoAdvertise with us Next Article HTML DOM title Property S Shubrodeep Banerjee Follow Improve Article Tags : Web Technologies HTML HTML-DOM Similar Reads 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 HTML DOM History go() Method The History go() method in HTML is used for loading a specific URL from the history list. It is a better alternative to history.back() and history.forward() methods if a number or the URL of the specific page is known and wants to load from your history. Syntax: history.go( number|URL )Parameters: T 2 min read Like