Anchor origin attribute
Definition and Usage
origin
The attribute returns href attribute value Protocol, hostname, and port number.
Note:If the port number is not specified in the URL (or if it is the default port of the scheme - for example, 80 or 443), some browsers will not display the port number.
Note:This property is read-only.
See also:
JavaScript Reference Manual:location.origin property
Example
Returns the protocol, hostname, and port number of the link:
var x = document.getElementById("myAnchor").origin;
Grammar
anchorObject.origin
Technical Details
Return Value: |
String value, representing the protocol (including ://), domain (or IP address), and port number (including the colon in the URL). Different browsers return different values for URLs using the file: protocol. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Supported | Not Supported | Supported | Supported | Supported |