JavaScript window location protocol property enables you to get the name of the protocol used to access the current web page e.g.: http, https or ftp. If the current web page URL starts with "http://" then protocol property returns "http:". JavaScript location object belongs to JavaScript window object that allows you to access the protocol property using window.location.protocol. You can also access the protocol property directly as location.protocol.
Try the sample below to learn and practice the code functionality of JavaScript window location protocol property: