Anchor origin 属性
定义和用法
origin
属性返回 href 属性值 的协议、主机名和端口号。
注释:如果 URL 中未规定端口号(或者如果它是方案的默认端口 - 例如 80 或 443),则某些浏览器将不会显示端口号。
注释:该属性只读。
另请参阅:
JavaScript 参考手册:location.origin 属性
语法
anchorObject.origin
Technical Details
Return Value: |
String value, representing the protocol (including ://), domain (or IP address), and port number (including the colon : of the URL). For URLs using the file: protocol, the return values differ between browsers. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Supported | Not Supported | Supported | Supported | Supported |