HTMLHyperlinkElementUtils.username 特性为 USVString containing the username specified before the domain name.

句法

string = object.username;
object.username = string;
					

范例

// Let's <a id="myAnchor" href="https://anonymous:flabada@developer.mozilla.org/en-US/docs/HTMLHyperlinkElementUtils.username"> be in the document
var anchor = document.getElementByID("myAnchor");
var result = anchor.username; // Returns:'anonymous'
					

规范

规范 状态 注释
HTML 实时标准
The definition of 'HTMLHyperlinkElementUtils.username' in that specification.
实时标准 初始定义。

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
username Chrome Yes
Yes
Starting in Chrome 52, this property was moved to URL
Edge 79 Firefox 26
26
From Firefox 26 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
IE No Opera Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari Yes WebView Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Chrome Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Firefox Android 26
26
From Firefox 26 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
Opera Android Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari iOS Yes Samsung Internet Android Yes
Yes
Starting in Samsung Internet 6.0, this property was moved to URL

图例

完整支持

完整支持

不支持

不支持

见实现注意事项。

另请参阅

元数据

  • 最后修改:
  1. URL API
  2. HTMLHyperlinkElementUtils
  3. 特性
    1. hash
    2. host
    3. hostname
    4. href
    5. origin
    6. password
    7. pathname
    8. port
    9. 协议
    10. search
    11. username
  4. 方法
    1. toString()
  5. 实现通过:
    1. HTMLAnchorElement
    2. HTMLAreaElement
  6. Related pages for URL API
    1. URL
    2. URLSearchParams
    3. URLUtilsReadOnly

版权所有  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1