Example
Return the protocol, hostname and port number of the URL for a specific area in an image-map:
var x =
document.getElementById("venus").origin;
The result of x will be:
http://www.w3ii.com:80
Try it Yourself »
Definition and Usage
The origin property returns the protocol, hostname and port number of the href attribute value.
The href attribute specifies the destination of a link in an area.
Note: If the port number is not specified in the URL (or if it is the scheme's default port - like 80, or 443), some browsers will not display the port number.
Note: This property is read-only.
Browser Support
Property | |||||
---|---|---|---|---|---|
origin | Yes | Not supported | Yes | Yes | Yes |
Syntax
areaObject.origin
Technical Details
Return Value: | A String, representing the protocol (including ://), the domain name (or IP address) and port number (including the colon sign (:) of the URL. For URL's using the file: protocol, the return value differs between browsers |
---|
Related Pages
JavaScript reference: location.origin Property
< Area Object