我正在查看 XHR 规范 here它只说:
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 中的什么位置?
最佳答案
需要考虑的事项:
- 如果用户名为
''
或密码为空,则不会使用 URL 凭据 - IE 不会传输 open 方法的第 4 个和第 5 个参数,除非服务器使用 401 HTTP 状态代码向客户端询问凭据
- Chrome 19 dropped support for URL embedded identities
What does this mean?
如果第 5 步产生的请求 URL 不为空,则意味着它可能包含身份验证部分。此组件在 RFC 2396 中称为 userinfo
.
Where does the xhr [sic] put it in the URL?
方案:[//[用户:密码@]主机[:端口]][/]路径[?query][#fragment]
关于javascript - xhr.open() 对给定的用户名和密码做什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38798459/