Availability: |
| ||||||
Property/method value type: | String primitive | ||||||
JavaScript syntax: | - | myUrl.protocol | |||||
- | myUrl.protocol = aProtocol | ||||||
HTML syntax: | <A HREF="..."> <LINK HREF="..."> | ||||||
Argument list: | aProtocol | A valid protocol for the URL that the browser supports |
This property yields text string that contains the protocol value from the URL if there is one and an empty string if not.
Using this property as an LValue, you can redefine the protocol for the link if it has an HREF. You might want to do this if you want to change the way you access a particular document.
<HTML> <HEAD> </HEAD> <BODY> <A NAME="EXAMPLE" HREF="http://www.mydomain.com:8080/folder/file.html#abcdef">Click here</A><BR> <SCRIPT> // In testing, this did not work in Opera 5.0 document.write(document.links[0].protocol); </SCRIPT> </BODY> </HTML>
See also: | Anchor.hash, Anchor.protocol, IMG.protocol, URL, Url object, Url.hash, Url.host, Url.hostname, Url.href, Url.pathname, Url.port, Url.search, Url.target |
Prev | Home | Next |
Url.port | Up | Url.protocolLong |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |