xhr.open()对给定的用户名和密码做什么

What does xhr.open() do with a given username and password?

本文关键字:用户 密码 什么 open xhr      更新时间:2023-09-26

我在这里查看XHR规范,它所说的只是:

If parsedURL's host is non-null, run these substeps:
* If the username argument is not null, set the username given parsedURL and username.
* If the password argument is not null, set the password given parsedURL and password.

这是什么意思?xhr把它放在URL的什么位置?

需要考虑的事项:

  • 如果用户名为''或密码为null,则不会使用URL凭据
  • IE不会传输open方法的第4个和第5个参数,除非服务器用401 HTTP状态码向客户端询问凭据
  • Chrome 19放弃了对URL嵌入身份的支持

这是什么意思?

如果步骤5产生的请求URL不为null,则意味着它可能包含一个身份验证部分。这个组件在RFC 2396中被称为userinfo

xhr[sic]把它放在URL的什么地方?

scheme:[/[user:password@]host[:port]][/]path[?query][#fragment]