JavaScript Location protocol Property Last Updated : 23 Dec, 2022 Comments Improve Suggest changes Like Article Like Report A network protocol defines rules and conventions for communication between network devices. By adopting these rules, two devices can communicate with each other and can interchange information. The protocol property sets or returns the protocol of the current URL, including the colon (:). Syntax: location.protocol Properties: ftp: The File Transfer Protocol (FTP) is a standard network protocol used for the transfer of computer files between a client and server on a computer network.http: The Hypertext Transfer Protocol (HTTP) is an application protocol for distributed systems.https: The Hypertext Transfer Protocol Secure (HTTPS) is an extension of the Hypertext Transfer Protocol (HTTP) for secure communication and is widely used on the Internet.file: It is used for files or in the local server system.mailto: It is used in the mail system. Return Value: It returns a string(The protocol property returns the protocol of the current URL, including the colon (:)). Example: HTML <body style="align-items: center; margin-left: auto; justify-content: center;"> <div> <h1 id="Gfg" style="color: green;"> GeeksforGeeks </h1> <p> Click to know the protocol of current URL. </p> <button onclick="Protocol()"> Protocol </button> </div> <script> function Protocol() { var gfg = location.protocol; alert("protocol is: " + gfg); } </script> </body> Output: Comment More infoAdvertise with us Next Article JavaScript Location protocol Property N Naman_Garg Follow Improve Article Tags : JavaScript Web Technologies JavaScript-Properties Similar Reads HTML DOM Location protocol Property 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 1 min read HTML DOM Anchor protocol Property The Anchor protocol Property in HTML DOM is used to set or return the value of the protocol part of the href attribute value. The protocol is used to specify how data are transmitted between two computers. Syntax:  It returns the Anchor protocol property. anchorObject.protocolIt is used to set the 2 min read HTML DOM Area protocol Property The Area 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 part of the current URL, including the colon (:). Syntax: It returns the Area protocol property. areaObject.protocolIt is used to set the Area prot 2 min read Web API URL.protocol Property The Web API URL.protocol property is used to get USVString containing the protocol scheme of the URL. Syntax: var str = URL.protocol Return Value: This property returns a USVString containing the protocol scheme of the URL. Example 1: HTML <!DOCTYPE html> <html> <body> <h1>Ge 1 min read HTML DOM Window.location Property HTML DOM Window.location property returns a Location object that contains information about the current location of the document. Window.location is read-only property. Syntax: var loc = window.location; Return Value: An object containing information about the location of the document. Example: This 1 min read Like