location Properties DHTML Objects
Returns the access method of a URL.
HTML |
N/A |
Script |
object.protocol [ = sProtocol ] |
sProtocol |
Specifies the protocol used to transfer information. |
The property is read/write with no default value.
The protocol property specifies how information is transferred from the host to the client. Microsoft® Internet Explorer® supports several predefined protocols, including http and ftp.
The protocol property returns the initial substring of a URL, including the first colon ( for example: http: ). However, the document and location objects expose the protocol property as read-only and the property returns the expanded text of the protocol acronym. For example, the http protocol is returned as Hypertext Transfer Protocol.
The following example displays the document protocol property in a message box.
alert ( document.protocol )
Show me
A, AREA, document, IMG, location