URL.username

您正在阅读此内容的英文版本,因为该语系尚未翻译。 帮助我们翻译此文章吧!

 URL接口的username属性是USVString ,其中包含域名前指定的username 。

Note: 此特性在 Web Worker 中可用。

语法

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

一个 USVString.

例子

var url = new URL("https://anonymous:flabada@developer.mozilla.org/en-US/docs/Web/API/URL/username");
var user = url.username; // 返回:“anonymous”

规范

规范 状态 说明
URL
username
Living Standard 初步定义

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
usernameChrome Full support 32Edge Full support 12Firefox Full support 26IE ? Opera Full support YesSafari Full support 10WebView Android Full support ≤37Chrome Android Full support 32Firefox Android Full support 26Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

参考

  • 所属的 URL接口。